bot.py
import os
import random
import discord
from dotenv import load_dotenv
from discord.ext import commands
from discord.ext.commands import Bot
bot = Bot("!")
load_dotenv()
TOKEN = os.getenv('TOKEN')
GUILD = os.getenv('TOKEN')
client = commands.Bot(command_prefix = '.')
@client.event
async def on_ready():
print(
f'{client.user} has connected to Discord!'
)
@client.event
async def on_member_join(member):
print(f'{member} has joined a server.')
@client.event
async def on_member_remove(member):
print(f'{member} has left a server.')
@client.command(aliases=['encouragement'])
async def _encouragement(ctx, *, question):
responses -['You Got This!','I believe In You!','Go Get Em!']
await ctx.send(f'Question: {question}\nAnswer: {random.choice(responses)}')
client.run('TOKEN')
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).
system
Closed
April 6, 2022, 11:21am
3
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.