Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DiscordInviteCreateScriptEvent #59

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

MrMaleficus
Copy link

Adding a DiscordInviteCreateScriptEvent to allow the monitoring of created invitations

@mcmonkey4eva
Copy link
Member

mcmonkey4eva commented Dec 8, 2024

Automatic refusal without looking because this was written on the github web editor. Write code locally and don't commit until you've tested it. edit i am wrong

@mcmonkey4eva mcmonkey4eva reopened this Dec 8, 2024
@@ -81,6 +81,7 @@ public void onEnable() {
ScriptEvent.registerScriptEvent(DiscordUserLeavesScriptEvent.class);
ScriptEvent.registerScriptEvent(DiscordUserNicknameChangeScriptEvent.class);
ScriptEvent.registerScriptEvent(DiscordUserRoleChangeScriptEvent.class);
ScriptEvent.registerScriptEvent(DiscordInviteCreateScriptEvent.class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the registration list is in alphabetical order (ie the order that your intellij file list should have them in anyway)

// <context.group> returns the DiscordGroupTag.
// <context.channel> returns the DiscordChannelTag.
// <context.user> returns the DiscordUserTag of the invitation creator.
// <context.code> returns the ElementTag of the invitation code (after the "/" in the URL.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

started a ( but didn't end it )

Also "the ElementTag of" is redundant

// <context.channel> returns the DiscordChannelTag.
// <context.user> returns the DiscordUserTag of the invitation creator.
// <context.code> returns the ElementTag of the invitation code (after the "/" in the URL.
// <context.url> returns the ElementTag of the invitation URL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

. at end

case "user":
return new DiscordUserTag(botID, getEvent().getInvite().getInviter());
case "code":
return new ElementTag(getEvent().getInvite().getCode());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

, true on the elementtag constructors

@MrMaleficus
Copy link
Author

Updated

// <context.group> returns the DiscordGroupTag.
// <context.channel> returns the DiscordChannelTag.
// <context.user> returns the DiscordUserTag of the invitation creator.
// <context.code> returns the invitation code (after the latest "/" in the URL).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you meant last not latest

// @Context
// <context.bot> returns the relevant DiscordBotTag.
// <context.group> returns the DiscordGroupTag.
// <context.channel> returns the DiscordChannelTag.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd provide context here for at least the channel (and maybe also the group?), as it's not super clear what is it on first read - I assume the channel the invite leads to?
Otherwise LGTM

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍🏻

@mcmonkey4eva
Copy link
Member

I should have asked earlier but I wasn't paying enough attention: How is this in any way relevant to dDiscordBot? What possible use could there be for monitoring invites from your minecraft server?

@MrMaleficus
Copy link
Author

On my server, I have implemented a referral system that rewards players who bring in other players. This event allows me to link created and used invitations to specific players and create new referrals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants