I am developing a Discord bot that incentivizes users based on their number of successful invites. The issue is that while the API allows users to check their invite count using a command like !invites, this can easily be exploited by bots. I’m seeking a method to prevent such manipulation.
Here’s my current implementation:
[Command("checkInvitation")]
public async Task CheckInviter()
{
var invites = await Context.Guild.GetInvitesAsync();
foreach (var invite in invites)
{
if (Context.User.Username + "#" + Context.User.Discriminator == invite.Inviter.ToString())
{
await Context.Channel.SendMessageAsync(invite.Uses.ToString());
}
}
}
I considered verifying the invite link after a user joins, but it seems this detail isn’t part of the API. Despite the documentation suggesting that inviter details can be accessed, I am uncertain about utilizing IInviteMetadata.
In summary, I need guidance to build a Discord bot that accurately counts valid invites for users and removes an invite once the invited user exits, requiring the new member to stay in the group for 10 minutes to be considered a valid invite.