i said i’d make one of these ages ago, the idea was to start this early so that i didn’t have to cover much, but i got ahead of myself.
anyway, since this is a very long post, i’ll put the rest under the cut for y’all.
( Disclaimer; i’m not a professional programmer, this is just a hobby of mine. i’m self-taught and some of the stuff i post here isn’t the best way you could make a bot. if you actually wanna learn from professionals invest into some courses )
so, for the record; benrybot (passbotry) is a bot coded on python using the discord.py API. it’s quite small, i only started work on it five days ago.
if y’all are interested in making a bot yourselves, the discord.py website has everything you need to install it and get started; bithub and stackoverflow are your friends.
anyways, i’m explaining the code from the start;
these are all the imports i’m using for the bot, they always go at the top of your code so that python recognizes and unpacks/processes all these imports before touching any of the other code. imports are basically like additional code packs that you download and then can use on python.
most of these are just here to let me access discord.py’s features, except the ‘random’ import which is a randomizing commandset,
these lines of code and basically an authentication process telling me what the bot is online, and setting it’s status ( you can see i tried to label it with comments (the red writing))
-
now here’s where the actual commands begin;
‘@client.event ‘ is the line that lets the bot know this is the start of a command, referred to as an event. ‘client. ‘ is the prefix to most lines of code featuring the bot.
‘async def on_message(message):’ tells the program that the next line is defining what the bot will do during the command/event. ‘on_message’ means this event is triggered when any message is sent on the server.
‘ if message.content == “benbot test”: ‘ just means if there’s a message that says ‘benbot test’, we’ll initiate the next line of code. if not, the bot does nothing.
‘ await client.send_message(message.channel, “success”)’. ‘await’ lets the bot multitask, instead of waiting to finish any other processes it skips to the await line, ‘client.sned_message’ send the message, ‘(message.channel,’ means it will be sent in the same channel and “success” was the content of our message.
so the result of these lines of code is:
the bot processes that ‘benbot test’ has been sent and replies in the same channel with it’s predetermined response (please don’t mind the bot’s nickname on this example.)
anyway, that’d be it for part one of benrybot’s behind the scenes.
on the next post i’ll go into detail on benrybot’s more complex commands, formatting and the random.choice function.
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
✓ Live Streaming✓ Interactive Chat✓ Private Shows✓ HD Quality
Anya is LIVE right now
FREE
Free to watch • No registration required • HD streaming