Working bot
This commit is contained in:
parent
0d6a5e01f9
commit
15391cf67a
33
main.py
33
main.py
@ -4,26 +4,27 @@ from dotenv import load_dotenv
|
||||
|
||||
BOT_NAME = "Dumb Bitch"
|
||||
|
||||
intents = discord.Intents.default()
|
||||
bot = discord.Client(intents=intents)
|
||||
|
||||
class MyClient(discord.Client):
|
||||
async def on_ready(self):
|
||||
print(f"Logged on as {self.user}.")
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
print(f"{bot.user} has logged in.")
|
||||
|
||||
|
||||
@bot.event
|
||||
async def on_message(message):
|
||||
if message.author == bot.user:
|
||||
return
|
||||
if message.content == "hello":
|
||||
await message.channel.send(f"Hey {message.author}")
|
||||
if message.content == "goodbye":
|
||||
await message.channel.send(f"Goodbye {message.author}")
|
||||
async def on_message(self, message):
|
||||
print(f"Message from {message.author}: {message.content}")
|
||||
if message.author == self.user:
|
||||
return
|
||||
if message.content == "hello":
|
||||
await message.channel.send(f"Hey {message.author}")
|
||||
if message.content == "goodbye":
|
||||
await message.channel.send(f"Goodbye {message.author}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
load_dotenv()
|
||||
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
|
||||
bot.run(DISCORD_TOKEN)
|
||||
|
||||
# intents = discord.Intents.default()
|
||||
# intents.message_content = True
|
||||
intents = discord.Intents.all()
|
||||
client = MyClient(intents=intents)
|
||||
client.run(DISCORD_TOKEN)
|
||||
|
Loading…
Reference in New Issue
Block a user