-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
836c73d
commit 70a5e61
Showing
20 changed files
with
395 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/main/java/com/denizenscript/ddiscordbot/events/DiscordChannelCreateScriptEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.denizenscript.ddiscordbot.events; | ||
|
||
import com.denizenscript.ddiscordbot.DiscordScriptEvent; | ||
import com.denizenscript.ddiscordbot.objects.DiscordChannelTag; | ||
import com.denizenscript.ddiscordbot.objects.DiscordGroupTag; | ||
import com.denizenscript.denizencore.objects.ObjectTag; | ||
import net.dv8tion.jda.api.events.channel.ChannelCreateEvent; | ||
|
||
public class DiscordChannelCreateScriptEvent extends DiscordScriptEvent { | ||
|
||
// <--[event] | ||
// @Events | ||
// discord channel created | ||
// | ||
// @Switch for:<bot> to only process the event for a specified Discord bot. | ||
// @Switch group:<group_id> to only process the event for a specified Discord group. | ||
// @Switch type:<type> to only process the event if the channel is a specific channel_type. | ||
// | ||
// @Triggers when a Discord channel is created. | ||
// | ||
// @Plugin dDiscordBot | ||
// | ||
// @Group Discord | ||
// | ||
// @Context | ||
// <context.bot> returns the relevant Discord bot object. | ||
// <context.group> returns the group. | ||
// <context.channel> returns the new channel. | ||
// --> | ||
|
||
public static DiscordChannelCreateScriptEvent instance; | ||
|
||
public DiscordChannelCreateScriptEvent() { | ||
instance = this; | ||
registerCouldMatcher("discord channel created"); | ||
registerSwitches("group", "type"); | ||
} | ||
|
||
public ChannelCreateEvent getEvent() { | ||
return (ChannelCreateEvent) event; | ||
} | ||
|
||
@Override | ||
public boolean matches(ScriptPath path) { | ||
if (!tryGuild(path, getEvent().getGuild())) { | ||
return false; | ||
} | ||
if (!runGenericSwitchCheck(path, "type", getEvent().getChannelType().name())) { | ||
return false; | ||
} | ||
return super.matches(path); | ||
} | ||
|
||
@Override | ||
public ObjectTag getContext(String name) { | ||
switch (name) { | ||
case "group": | ||
return new DiscordGroupTag(botID, getEvent().getGuild()); | ||
case "channel": | ||
return new DiscordChannelTag(botID, getEvent().getChannel()); | ||
} | ||
return super.getContext(name); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "DiscordChannelCreated"; | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/com/denizenscript/ddiscordbot/events/DiscordChannelDeleteScriptEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.denizenscript.ddiscordbot.events; | ||
|
||
import com.denizenscript.ddiscordbot.DiscordScriptEvent; | ||
import com.denizenscript.ddiscordbot.objects.DiscordChannelTag; | ||
import com.denizenscript.ddiscordbot.objects.DiscordGroupTag; | ||
import com.denizenscript.denizencore.objects.ObjectTag; | ||
import net.dv8tion.jda.api.events.channel.ChannelDeleteEvent; | ||
|
||
public class DiscordChannelDeleteScriptEvent extends DiscordScriptEvent { | ||
|
||
// <--[event] | ||
// @Events | ||
// discord channel deleted | ||
// | ||
// @Switch for:<bot> to only process the event for a specified Discord bot. | ||
// @Switch group:<group_id> to only process the event for a specified Discord group. | ||
// | ||
// @Triggers when a Discord channel is created. | ||
// | ||
// @Plugin dDiscordBot | ||
// | ||
// @Group Discord | ||
// | ||
// @Context | ||
// <context.bot> returns the relevant Discord bot object. | ||
// <context.group> returns the group. | ||
// <context.channel> returns the new channel. | ||
// --> | ||
|
||
public static DiscordChannelDeleteScriptEvent instance; | ||
|
||
public DiscordChannelDeleteScriptEvent() { | ||
instance = this; | ||
registerCouldMatcher("discord channel deleted"); | ||
registerSwitches("group"); | ||
} | ||
|
||
public ChannelDeleteEvent getEvent() { | ||
return (ChannelDeleteEvent) event; | ||
} | ||
|
||
@Override | ||
public boolean matches(ScriptPath path) { | ||
if (!tryGuild(path, getEvent().getGuild())) { | ||
return false; | ||
} | ||
return super.matches(path); | ||
} | ||
|
||
@Override | ||
public ObjectTag getContext(String name) { | ||
switch (name) { | ||
case "group": | ||
return new DiscordGroupTag(botID, getEvent().getGuild()); | ||
case "channel": | ||
return new DiscordChannelTag(botID, getEvent().getChannel()); | ||
} | ||
return super.getContext(name); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "DiscordChannelDeleted"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/main/java/com/denizenscript/ddiscordbot/events/DiscordThreadArchivedScriptEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.denizenscript.ddiscordbot.events; | ||
|
||
import com.denizenscript.ddiscordbot.DiscordScriptEvent; | ||
import com.denizenscript.ddiscordbot.objects.DiscordChannelTag; | ||
import com.denizenscript.ddiscordbot.objects.DiscordGroupTag; | ||
import com.denizenscript.denizencore.objects.ObjectTag; | ||
import net.dv8tion.jda.api.events.thread.ThreadHiddenEvent; | ||
|
||
public class DiscordThreadArchivedScriptEvent extends DiscordScriptEvent { | ||
|
||
// <--[event] | ||
// @Events | ||
// discord thread archived | ||
// | ||
// @Switch for:<bot> to only process the event for a specified Discord bot. | ||
// @Switch group:<group_id> to only process the event for a specified Discord group. | ||
// @Switch parent:<channel_id> to only process the event for a specific parent channel ID. | ||
// | ||
// @Triggers when a Discord thread is archived. | ||
// | ||
// @Plugin dDiscordBot | ||
// | ||
// @Group Discord | ||
// | ||
// @Context | ||
// <context.bot> returns the relevant Discord bot object. | ||
// <context.group> returns the group. | ||
// <context.thread> returns the thread channel. | ||
// --> | ||
|
||
public static DiscordThreadArchivedScriptEvent instance; | ||
|
||
public DiscordThreadArchivedScriptEvent() { | ||
instance = this; | ||
registerCouldMatcher("discord thread archived"); | ||
registerSwitches("group", "parent"); | ||
} | ||
|
||
public ThreadHiddenEvent getEvent() { | ||
return (ThreadHiddenEvent) event; | ||
} | ||
|
||
@Override | ||
public boolean matches(ScriptPath path) { | ||
if (!tryGuild(path, getEvent().getGuild())) { | ||
return false; | ||
} | ||
if (!tryChannel(path, getEvent().getThread().getParentChannel(), "parent")) { | ||
return false; | ||
} | ||
return super.matches(path); | ||
} | ||
|
||
@Override | ||
public ObjectTag getContext(String name) { | ||
switch (name) { | ||
case "group": | ||
return new DiscordGroupTag(botID, getEvent().getGuild()); | ||
case "thread": | ||
return new DiscordChannelTag(botID, getEvent().getThread()); | ||
} | ||
return super.getContext(name); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "DiscordThreadArchived"; | ||
} | ||
} |
Oops, something went wrong.