mirror of
https://github.com/idanoo/discord-keyword-bot.git
synced 2024-11-22 00:21:52 +00:00
Update for ping role
This commit is contained in:
parent
c6d668c65d
commit
b5624db074
@ -2,3 +2,4 @@ DISCORD_TOKEN=""
|
||||
DISCORD_CHANNELS="id1,id2,id3"
|
||||
SOURCE_CHANNEL=""
|
||||
REGEX_MATCH="^.*(K41|COVID).*$"
|
||||
PING_ROLE=""
|
||||
|
@ -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"
|
||||
|
||||
|
5
bot.py
5
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()
|
||||
|
Loading…
Reference in New Issue
Block a user