Hey all, I published this tutorial on writing chatbots with Python and Discord a few weeks ago and I'm excited to share it with you here now. I'm watching the comments here and over at codementor so let me know if you have any questions.
https://www.codementor.io/garethdwyer/building-a-discord-bot-with-python-and-repl-it-miblcwejz
@GarethDwyer1 Here it is:
from keep_alive import keep_aliveimport discordimport os
client = discord.Client()
@client.eventasync def on_ready(): print("I'm in") print(client.user)
@client.eventasync def on_message(message): if message.author != client.user: await message.channel.send(message.content[::-1])
keep_alive()token = os.environ.get("DISCORD_BOT_SECRET")client.run(token)
Hey all, I published this tutorial on writing chatbots with Python and Discord a few weeks ago and I'm excited to share it with you here now. I'm watching the comments here and over at codementor so let me know if you have any questions.
https://www.codementor.io/garethdwyer/building-a-discord-bot-with-python-and-repl-it-miblcwejz
@GarethDwyer1 Here it is:
from keep_alive import keep_alive
import discord
import os
client = discord.Client()
@client.event
async def on_ready():
print("I'm in")
print(client.user)
@client.event
async def on_message(message):
if message.author != client.user:
await message.channel.send(message.content[::-1])
keep_alive()
token = os.environ.get("DISCORD_BOT_SECRET")
client.run(token)