Skip to content

Commit

Permalink
add message ids to events, for #18
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 19, 2019
1 parent 9e3fcc0 commit 8098af3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class DiscordMessageDeletedScriptEvent extends DiscordScriptEvent {
// <context.is_direct> returns whether the message was sent directly to the bot (if false, the message was sent to a public channel).
// <context.old_message_valid> returns whether the old message is available (it may be lost due to caching).
// <context.message> returns the original message (raw).
// <context.message_id> returns the message ID.
// <context.no_mention_message> returns the original message with all user mentions stripped.
// <context.formatted_message> returns the formatted original message (mentions/etc. are written cleanly). CURRENTLY NON-FUNCTIONAL.
//
Expand Down Expand Up @@ -99,6 +100,9 @@ else if (name.equals("message")) {
return new ElementTag(getEvent().getMessage().get().getContent().get());
}
}
else if (name.equals("message_id")) {
return new ElementTag(getEvent().getMessageId().asString());
}
else if (name.equals("no_mention_message")) {
if (getEvent().getMessage().isPresent()) {
return new ElementTag(stripMentions(getEvent().getMessage().get().getContent().get(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class DiscordMessageModifiedScriptEvent extends DiscordScriptEvent {
// <context.mention_names> returns a list of all mentioned user names.
// <context.is_direct> returns whether the message was sent directly to the bot (if false, the message was sent to a public channel).
// <context.message> returns the message (raw).
// <context.message_id> returns the message ID.
// <context.no_mention_message> returns the message with all user mentions stripped.
// <context.formatted_message> returns the formatted message (mentions/etc. are written cleanly). CURRENTLY NON-FUNCTIONAL.
// <context.old_message_valid> returns whether the old message is available (it may be lost due to caching).
Expand Down Expand Up @@ -115,6 +116,9 @@ else if (name.equals("old_formatted_message")) {
else if (name.equals("message")) {
return new ElementTag(getEvent().getMessage().block().getContent().orElse(""));
}
else if (name.equals("message_id")) {
return new ElementTag(getEvent().getMessageId().asString());
}
else if (name.equals("no_mention_message")) {
return new ElementTag(stripMentions(getEvent().getMessage().block().getContent().orElse(""),
getEvent().getMessage().block().getUserMentions()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class DiscordMessageReceivedScriptEvent extends DiscordScriptEvent {
// <context.group> returns the group ID.
// <context.group_name> returns the group name.
// <context.message> returns the message (raw).
// <context.message_id> returns the message ID.
// <context.no_mention_message> returns the message with all user mentions stripped.
// <context.formatted_message> returns the formatted message (mentions/etc. are written cleanly). CURRENTLY NON-FUNCTIONAL.
// <context.author> returns the user that authored the message.
Expand Down Expand Up @@ -92,6 +93,9 @@ else if (name.equals("group_name")) {
else if (name.equals("message")) {
return new ElementTag(getEvent().getMessage().getContent().orElse(""));
}
else if (name.equals("message_id")) {
return new ElementTag(getEvent().getMessage().getId().asString());
}
else if (name.equals("no_mention_message")) {
return new ElementTag(stripMentions(getEvent().getMessage().getContent().orElse(""),
getEvent().getMessage().getUserMentions()));
Expand Down

0 comments on commit 8098af3

Please sign in to comment.