Professional Documents
Culture Documents
Discord Bot
Discord Bot
By Stephen Fisher
# Import required libraries
import discord
import asyncio
import random
import datetime
TOKEN = 'YOUR_BOT_TOKEN'
# Set up intents to control which events the bot will listen for
intents = discord.Intents.default()
intents.typing = False
intents.presences = False
# Create a bot instance with the specified command prefix and intents
messages = [
'Aaaaaaahhhhh!!!',
'RAAAAAAAWWWWRRRRR!',
'GAAAAAAHHHHH!!!!!',
'Uuuuuuuuuggggggghhhhhh!!!!',
'WOOOOOOOAAAAAHHHHH!!!',
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAHHHHHH!',
'FFFFFFFFFFFFFUUUUUUUUUUUUUCCCCCKKKKKK',
'GODAMNIT!',
scream_message = random.choice(messages)
await channel.send(scream_message)
global next_scream_time
while True:
channel = bot.get_channel(channel_id)
if channel:
await send_scream(channel)
await asyncio.sleep(sleep_time)
@bot.event
print(f'{bot.user.name} is connected!')
bot.loop.create_task(post_random_message())
# Command: Responds with a greeting
global next_scream_time
if next_scream_time:
await ctx.send(f"Next scream is due in {hours} hours, {minutes} minutes, and {seconds} seconds.")
else:
@bot.event
role_name = "Audience" # Replace with the specific role name you want to add
if role:
await member.add_roles(role)
else: