diff --git a/.env.example b/.env.example index 1706bf5..8571e7b 100644 --- a/.env.example +++ b/.env.example @@ -2,3 +2,4 @@ DISCORD_TOKEN="" DISCORD_CHANNELS="id1,id2,id3" SOURCE_CHANNEL="" REGEX_MATCH="^.*(K41|COVID).*$" +PING_ROLE="" diff --git a/README.md b/README.md index c171928..0b92d07 100644 --- a/README.md +++ b/README.md @@ -20,5 +20,5 @@ copy .env.example to .env and setup your user Token in .env DISCORD_CHANNELS="channel_1_id,channel_2_id" SOURCE_CHANNEL="channel_id_to_listen_to" REGEX_MATCH="^.*(REGEX|TO|USE|TO|MATCH).*$" - + PING_ROLE="id_of_role" diff --git a/bot.py b/bot.py index 3d1d8f8..19abd80 100644 --- a/bot.py +++ b/bot.py @@ -15,7 +15,10 @@ class MyClient(discord.Client): chan_list = [x.strip() for x in os.getenv("DISCORD_CHANNELS").split(',')] for channel_id in chan_list: channel = client.get_channel(int(channel_id)) - await channel.send('*' + message.content + '*') + ping_string = '' + if os.getenv("PING_ROLE") != '': + ping_string = '<@&' + os.getenv("PING_ROLE") + '>: ' + await channel.send(ping_string + message.content) load_dotenv() client = MyClient()