-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiscordbot.py
30 lines (21 loc) · 896 Bytes
/
discordbot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# chatbridge by jrichter
import logging
import discord
logger = logging.getLogger('chatbridge')
"""
class SignalMessage(Message):
def __init__(self, id, sender, target, content, attachment, reactions):
super().__init__(id, sender, target, content, attachment, reactions)
"""
class DiscordBot(discord.Client):
async def on_ready(self):
logger.info('Login successful as user {0.user}'.format(self))
#await message.channel.send('received message:\n{0}'.format(message).replace('> ', '\n') )
async def on_message(self, message):
logger.debug(f'received {message}')
if message.author == super().user:
return
await message.channel.send('received message: {0}'.format(message.content))
if message.content.startswith('Hello'):
await message.channel.send('World!')
logger.debug('sent World!')