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

Boosts Events and Tags #60

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

Conversation

MrMaleficus
Copy link

@MrMaleficus MrMaleficus commented Dec 29, 2024

Adding 4 tags and 1 new event to support discord boosts integration.

New Tags

  • DiscordUserTag.is_boosting[<group>]
  • DiscordGroupTag.boosters
  • DiscordGroupTag.boost_tier
  • DiscordGroupTag.boosts_count

New Events

  • discord boosts count changes

Updating the java docs link to the new one.

// @description
// Returns a boolean indicating whether the user is boosting the specified group or not.
// -->
tagProcessor.registerTag(ElementTag.class, "is_boosting", (attribute, object) -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

could register with the required discordgrouptag input, see <DiscordUserTag.is_in_group[<group>]> for example

Copy link
Author

Choose a reason for hiding this comment

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

Done 😊 Thank you

@mcmonkey4eva
Copy link
Member

Same question as the other PR, how is this in any way relevant for dDiscordBot?

@MrMaleficus
Copy link
Author

With a system that links Minecraft accounts to Discord accounts, I give a reward, such as a badge, to all guild boosters. Additionally, when the guild levels up or down, an in-game message is sent to everyone to thank them for their support.

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

Choose a reason for hiding this comment

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

What group? ideally any meta entry should make it immediately clear upon first read (so whose boost count changed or something along those lines)

Comment on lines 27 to 28
// <context.new_count> returns the new amount of boosts of the group.
// <context.old_count> returns the old amount of boosts of the group.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe the group's new/old amount of boosts?

Comment on lines 200 to 204
ListTag list = new ListTag();
for (Member member : object.getGuild().getBoosters()) {
list.addObject(new DiscordUserTag(object.bot, member.getUser()));
}
return list;
Copy link
Member

Choose a reason for hiding this comment

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

Can use the ListTag convertor constructor

// @returns ListTag(DiscordUserTag)
// @plugin dDiscordBot
// @description
// Returns a list of all users in the group that currently boosts the group.
Copy link
Member

Choose a reason for hiding this comment

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

that currently boost it.

// @returns ElementTag(Number)
// @plugin dDiscordBot
// @description
// Returns the tier of the group currently set by its boosts.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just Returns the group's current boost tier, see <@link> for all possible tiers.?

});

// <--[tag]
// @attribute <DiscordGroupTag.tier>
Copy link
Member

Choose a reason for hiding this comment

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

Might be better to name it boost_tier, would match with boosts_count as well.

// Returns a boolean indicating whether the user is boosting the specified group or not.
// -->
tagProcessor.registerTag(ElementTag.class, DiscordGroupTag.class, "is_boosting", (attribute, object, group) -> {
if (object.getUser() == null) {
Copy link
Member

Choose a reason for hiding this comment

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

Should use #getUserForTag here, like the other tags

// @returns ElementTag(Boolean)
// @plugin dDiscordBot
// @description
// Returns a boolean indicating whether the user is boosting the specified group or not.
Copy link
Member

Choose a reason for hiding this comment

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

No need to specify a boolean, can just Returns whether X

@@ -240,6 +240,21 @@ public static void register() {
return new ElementTag(object.getUser().isBot());
});

// <--[tag]
// @attribute <DiscordUserTag.is_boosting[<group>]>
Copy link
Member

Choose a reason for hiding this comment

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

doesn't discord add an unremovable role for this

Copy link
Member

Choose a reason for hiding this comment

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

ie most of these tags and the event can be replaced by just scripts checking the role

Copy link
Author

Choose a reason for hiding this comment

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

The role can be renamed, this tag comes as an reliable alternative mean without using a RoleTag based input.

@MrMaleficus MrMaleficus requested a review from tal5 January 12, 2025 23:18
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.

4 participants