> From the BotGhost docs: https://botghost.com/docs/custom-commands-and-events/conditions/invite-condition
> Every page: https://botghost.com/docs/llms.txt

# Invite Condition

![An Invite Condition labelled Is this a real invite? in a tree, with its Fails and Passes branches](https://botghost.com/docs/content/assets/workspace/invites-condition-tree.png)

Invite Condition checks whether a join is a real invite: how they joined, their account, and who invited them. Blocks under **Passes** run for a real invite, and blocks under **Otherwise** run when it fails. Use it to welcome only real invites, send young accounts to a check channel, or warn staff when one inviter brings in a crowd. The [Invite Tracker](https://botghost.com/docs/server-management/invite-tracker) module uses it to decide which joins are fake.

It works best on [When a new user joins](https://botghost.com/docs/custom-commands-and-events/events#find-the-invite-they-used), where the inviter is filled in.

![The Invite Condition panel with Whose join, the Inviter, and the checks Joined through, Their account is at least and They have a profile picture](https://botghost.com/docs/content/assets/workspace/invites-condition.png)

## Whose join

- **Who joined**: the event's member (`{user_id}`) to start with, or an ID or a variable.
- **Inviter**: `{event_inviter_id}` to start with, which is filled in on When a new user joins. An inviter who isn't in the server fails.

## Checks

Turn on the ones you want. Each one passes when the join looks real.

| Check | Passes when | To start with |
| --- | --- | --- |
| Joined through | They joined one of the ways you pick: Invite, Personal link, Campaign, Vanity link, No inviter, Bot, Guest or Unknown | Off |
| Their account is at least | Their Discord account is at least this many days or hours old | On, 7 days |
| They have a profile picture | They don't have Discord's default picture | Off |
| Their name isn't flagged by AutoMod | AutoMod hasn't held back their name or server tag | Off |
| They weren't invited by themselves | Their own link or an alt doesn't count | On |
| The inviter isn't a bot | They didn't join through a bot's invite | On |
| The inviter's account is at least | The inviter's account is at least this old | Off, 7 days |
| The inviter doesn't have these roles | The inviter has none of the roles you pick. Empty skips it | Empty |
| The inviter brought in fewer than | The inviter brought in fewer than this many joins in the last number of seconds you pick | Off, 10 in 600 |
| They haven't been in the server before | Discord doesn't say they've been in the server before | Off |

A switch can also be turned on and off by a variable when it runs, like `{BGVAR_invites_track.age_on}`. The account checks work the same way as the [User Condition](https://botghost.com/docs/custom-commands-and-events/conditions/user-condition)'s.

With no check on, every join passes.

## Passes when

- **All of these pass** (to start with), or **Any of these pass**.

## Variables

| Variable | What it gives |
| --- | --- |
| `{invite_check_result}` | `real` when it passes, `fake` when it doesn't |
| `{invite_check_reason}` | The first check that failed, in words, like "the account is 2 days old" |
| `{invite_check_reason_code}` | The same as a code for [Change Invite Counts](https://botghost.com/docs/custom-commands-and-events/actions/server-actions/change-invite-counts): `young_account`, `self`, `no_avatar`, `flagged_name`, `young_inviter`, `burst` or `never_role` |

Put `{invite_check_result}` in Change Invite Counts' **Count it as** to count the join as real or fake in one block.
