Learn to Code via Tutorials on Repl.it

← Back to all posts
Tutorial: Building a Discord Bot with Python
GarethDwyer1 (94)

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

Commentshotnewtop
Luke_Watson (2)

lol my pig birthded a hen

CHanlon (0)

Just to let you know, to make this work with the newest version of discord.py, you need to change:

await client.send_message(message.channel, message.content[::-1])

to:

await message.channel.send(message.content[::-1])

saatvikrk (0)

When I try to run the bot code that you put on the tutorial, this error comes up:

Also:
when I ran discord.py it created 'poetry.lock' and 'pyproject.toml' but I cant see these files in the pictures you provided.
And when I run main.py, in requirements.text, underneath discord.py repl adds types 'discord' automatically.

Morgana123 (0)

how does one make the bot post images?

GarethDwyer1 (94)

@Morgana123 you'll have to pass an image Embed into the send message call. Take a look at the documentation for full details - a good starting point would be here https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed

ComputerWizard (0)

The website mentioned above no longer exists

GarethDwyer1 (94)

@ComputerWizard Sorry about the inconvenience! It looks like all codementor.io posts are currently going to 404 pages :/ I've reached out to them and hopefully they'll be back soon.

In the meantime you can see the post at https://hackmd.io/s/HJ71Hu4SX

[deleted]

I can't go to that site. It says that it's temporarily down or permanently moved to a new site.

Brawn (4)

Two questions
1)Could you do all of the steps in a browser or do you need the app to do it?
2)Is the code too advanced for a beginner, or is it do able with the basics?
I am a newbie in programming "for now" and I was interested in this challenge hoping that I could learn some js during the process. I would also love some tips for how to learn a language for a beginner like myself.
I would also like to hear your opinion on Rust, which I am attempting to learn. Things like is it too hard for a new comer and if it is worth learning

AlexanderHall4 (1)

this is pretty neat, i have been working on a text reaction program i called ARS (based of of the echo discord bots name), maybe i should throw it in the api and make a bot :)