0% found this document useful (0 votes)
2K views23 pages

Python Discord Bot Guide

Uploaded by

Sumit Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views23 pages

Python Discord Bot Guide

Uploaded by

Sumit Yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

DISCORD

SERVER BOT

MADE IN PYTHON
BY SAHIL JHANGAR
 Intro to project.
 Resources that we used.

INDEX
 Intro to discord.
 Commands to run bot.
 Backend code.
 Intro to async and await.
 Format of backend code.
 Code of bot in format wise.
 Output of each command and event.
 Future scope of bot.
 It’s a bot that accept commands and execute several
task.
 In code, discord package is used to connect bot to
discord server through their own cloud system.

ABOUT THE  In total we have 7 executable commands and 4


functional commands.
PROJECT.  goal of the project is to increase the functionality of
server(or we can say chat room).
 To use the command we have to use prefix “$”.
 I able to run project(my project) with any pc, condition
only needs to be python installed.
 Visual studio code

PLATFORM,  Power shell(for hosting and to run the program)

LANGUAGES  Python(language)
 Packages – discord, discord.py(extension), random(in-
AND MODULES built)

USED  Discord (windows application and mobile as well)


 Discord is an American originated application, instant
messaging and digital distribution platform designed
for creating communities. Users communicate
WHAT with voice calls, video calls, text messaging, media and
files in private chats or as part of communities called
ACTUALLY "servers." Servers are a collection of persistent chat
rooms and voice chat channels.
DISCORD IS ?  More and like highly qualified version of what’s app.
 You can share your screen within a group of people.
 Online – means you are active on discord.
 Idle – means you are not concatenated with any work
STATUS IN currently.

DISCORD  Do not disturb – you will not get any notification.


 Invisible – you will not appear online, but you have
full access to all of discord.
LOGO AND STATUS
• Name =bone_fire
• Action status = idle (designated by half moon)
• Working status = $help_box for help_box

• In working status, it shows the actual help command for


new users.
• By typing this command we got a a brief info of
commands.
 To run bot We can use power shell(or command
prompt,or directly by vs code).
 Commands for run bot:-
 1. to in directory in which your file .
 2. run this command “python file_name.py”
TO RUN BOT ON  For example:

OUR SERVER
 First time, when it online it sends a message in chat to
indicate all members that now it is available.

ON ACTIVE &
FIRST
RESPONSE
TO KNOW  To know about commands we have to type
“$help_box”
ABOUT  Which gives brief description about all commands and

COMMANDS functionality. (continued)……..nxt slide


OUTPUT OF
PREVIOUS
COMMAND
BEHIND
Backend code of bot
THE SCENES

 *Asynchronous programming is a means of parallel • Async functions and await are used here to achieve
the task of fetching content from command(orcode)
programming in which a unit of work runs separately
• Same concept have been applied
from the main application thread and notifies the throughout the python for the bot.
calling thread of its completion, failure or progress.
MORE ON ASYNCHRONOUS
PROGRAMMING
 Synchronous programming is our normal
programming in which pass the control to function and
wait for output but in asynchronous we ask function to
execute itself independently, and we do not depend on
it’s result.
 In this gif we see that func 2 only executes only when
1 is completed… so on so forth.
 But func 3 as it async it not depend on func 2 and 4 it
run completely independent.
 One is header – which mostly contain pre-required
things such as including external packages, defining
SECTIONS IN BACKEND CODE the bot and initializations of prefix command.
 Second is command body – which contain only
There are three sections commands async functions.
 Third is event body – which contain only events
related to only channel.
HEADER
 By first three lines we access three packages discord,
random(in-built), pyjokes.
 Importing the commands from discord extension.
 In last we initialize the bot prefix.
There are 8 commands that user can access:

 $Kick- to kick a member anonymously.


 $ban- to ban a member a anonymously.

COMMAND  $author- to get info about author.


 $jokes_netrual – to get random neutral jokes.
BODY
Second section
 $jokes_chuck- to get random chuck jokes.
 $love_quotes- to get random love quotes.
 $motiv_quotes- to give random motivational quotes.
 $help_box to get brief info about commands.

(Continue ……..for code)


F
C
O
M
M
A
N
D
S
In this we have 5 responsive action or events we can say:

 on deleting a message- it react with deleted


messages.
 on editing a message- it react with a edited message
and with a “confused comment”…..

EVENT BODY
Last and third section
 on message how old you are ?- it display message
depends on situation.
 On it’s first boot- it says “bot at your service ”
 On it’s disconnect- it says “it’s time to leave ok bie
bruh……”
E
V
E
N
T
S
OUTPUT OF EVERY COMMAND
*

* Commands marked with*


 f
always give random
answers.

* *
OUTPUT OF
EVENTS

 f
 Bot can be used to play music, in server.
 Bots are used to send messages to every member
personally.

FUTURE SCOPE  Bots are able to kick member, if anyone uses bad
language or share nsfw stuff.
OF BOT  by using bot we can play tic-tac-toe with other
players.
 Bots are able to shuffle member according to their
response in meeting(or we can say server).

You might also like