Skip to content

Commit 5a07833

Browse files
committed
Fix echo mention sample plugin, add comment headers to example plugins
1 parent 40bed9f commit 5a07833

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

example_plugins/echo_dm_example.py example_plugins/echo_mentions_example.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
# Simple functional plugin that shows how to subscribe to an event and
2+
# how to send discord messages.
3+
14
from nedry.event_types import EventType
25
from nedry import events
36
from nedry.plugin import PluginModule
47

58

6-
class EchoDmExample(PluginModule):
9+
class EchoMentionsExample(PluginModule):
710
"""
811
Simple plugin that subscribes to the EventType.DISCORD_BOT_MENTION event,
912
and whenever a message starting with a bot mention is seen in any public channel
@@ -16,9 +19,9 @@ class EchoDmExample(PluginModule):
1619
plugin_long_description = ""
1720

1821
def _on_mention(self, message, text_without_mention):
19-
# Whenever anybody mentions the bot in a public channel, take the
20-
# text after the mention and echo it back to the same user in a DM
21-
self.discord_bot.send_dm(message.author, message.content)
22+
# Whenever anybody mentions the bot in a public channel, take the text after
23+
# the mention and echo it back to the same channel the mention was seen on
24+
self.discord_bot.send_message(message.channel, text_without_mention)
2225

2326
def open(self):
2427
"""

example_plugins/plugin_template.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Empty plugin template that has all the boilerplate you'll need to get started
2+
# with most plugin implementations. Copy/paste this file to start your plugin.
3+
14
from nedry.event_types import EventType
25
from nedry import events
36
from nedry.plugin import PluginModule
@@ -51,7 +54,7 @@ def command1_handler(cmd_word, args, message, proc, config, twitch_monitor):
5154

5255
class PluginTemplate(PluginModule):
5356
"""
54-
Plugin template showing the boilerplate needed for most plugins
57+
Plugin template showing the structure required for a custom plugin
5558
"""
5659
plugin_name = "Unique and succint plugin name"
5760
plugin_version = "1.0.0"

0 commit comments

Comments
 (0)