First commit
This commit is contained in:
47
bot.py
Normal file
47
bot.py
Normal file
@@ -0,0 +1,47 @@
|
||||
# bot.py
|
||||
import os
|
||||
import discord
|
||||
import random
|
||||
from dotenv import load_dotenv
|
||||
|
||||
intents = discord.Intents.default()
|
||||
intents.message_content = True
|
||||
|
||||
load_dotenv()
|
||||
TOKEN = os.getenv('DISCORD_TOKEN')
|
||||
GUILD = os.getenv('DISCORD_GUILD')
|
||||
|
||||
client = discord.Client(intents=intents)
|
||||
|
||||
@client.event
|
||||
async def on_ready():
|
||||
guild = discord.utils.find(lambda g: g.name == GUILD, client.guilds)
|
||||
print(
|
||||
f'{client.user} is connected to the following guild:\n'
|
||||
f'{guild.name}(id: {guild.id})'
|
||||
)
|
||||
|
||||
members = '\n - '.join([member.name for member in guild.members])
|
||||
print(f'Guild Members:\n - {members}')
|
||||
|
||||
@client.event
|
||||
async def on_message(message):
|
||||
if message.author == client.user:
|
||||
return
|
||||
|
||||
brooklyn_99_quotes = [
|
||||
'I\'m the human form of the 💯 emoji.',
|
||||
'Bingpot!',
|
||||
(
|
||||
'Cool. Cool cool cool cool cool cool cool, '
|
||||
'no doubt no doubt no doubt no doubt.'
|
||||
),
|
||||
]
|
||||
|
||||
if message.content == '99!':
|
||||
response = random.choice(brooklyn_99_quotes)
|
||||
await message.channel.send(response)
|
||||
|
||||
|
||||
|
||||
client.run(TOKEN)
|
||||
Reference in New Issue
Block a user