-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
53 lines (38 loc) · 1.61 KB
/
bot.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from discord.ext import commands
from discord.ext.commands import Bot
import os
import discord
# from dotenv import load_dotenv
# load_dotenv()
# TOKEN = os.getenv('DISCORD_TOKEN')
# GUILD = os.getenv('DISCORD_GUILD')
# client = discord.Client()
Client = discord.Client()
client = commands.Bot(command_prefix="!")
@client.event
async def on_ready():
print("Bot is ready!")
# ps: did not know what to take as guild-name parameter
# guild = discord.utils.get(client.guilds, name=GUILD)
guild = discord.utils.get(client.guilds)
if guild:
print(
f'{client.user} is connected to the following guild:\n'
f'{guild.name}(id: {guild.id})'
)
channels = '\n - '.join([channel.name for channel in guild.channels])
print(f'Guild Channels:\n - {channels}')
@client.event
async def on_message(message):
if message.author.bot:
return
if message.content == "cookie":
await message.channel.send(":cookie:")
# Reagiere auf das kürzel HZP um Informationen für die Hochschulzugangsprüfung an zu zeigen.
# ToDo: Nur alle x Tage oder alle x Meldungen darauf reagieren...
if 'hzp' in message.content.lower():
await message.channel.send('**Wichtige Informationen** zur **HZP** findest du auch auf unserem Discourse unter: https://talk.wb-student.org/tag/hzp')
elif 'wbtalk' in message.content.lower():
await message.channel.send('**** zur **HZP** findest du auch auf unserem Discourse unter: https://talk.wb-student.org/tag/hzp')
client.run(
'ODM4ODUwMjY3Nzc1NzYyNDYy.YJBGMA.wpVrxtREaRwh1eQh_CerGo0xrJE', bot=True)