-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbot.py
108 lines (83 loc) · 4.79 KB
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import discord
from discord.ext import commands
import os
import pymongo
clientmongo = pymongo.MongoClient("mongodb+srv://pratham1729:[email protected]/myFirstDatabase?retryWrites=true&w=majority")
db = clientmongo.test
intents = discord.Intents().all()
client=commands.Bot(command_prefix="_",intents=intents,help_command=None)
@client.event
async def on_ready():
print("Bot is ready")
@client.event
async def on_member_join(member):
print(f"{member} has joined the server")
@client.event
async def on_member_remove(member):
print(f'{member} has left the server')
@client.command()
async def load(ctx,extension):
client.load_extension(f"cogs.{extension}")
@client.command()
async def unload(ctx,extension):
client.unload_extension(f"cogs.{extension}")
@client.command()
async def reload(ctx,extension):
client.unload_extension(f"cogs.{extension}")
client.load_extension(f"cogs.{extension}")
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
client.load_extension(f"cogs.{filename[:-3]}")
@client.command()
async def hello(ctx,text="Say something dumbass"):
await ctx.send(text)
@client.command(pass_context = True)
async def help(ctx):
embed = discord.Embed(
colour = discord.Colour.green())
embed.set_thumbnail(url= client.user.avatar_url)
embed.set_author(name = 'Help : list of commands available')
embed.add_field(name = '_info', value = 'Gives info about the pksbot', inline = False)
embed.add_field(name = '_all', value = 'List of all commands', inline = False)
await ctx.send(embed = embed)
@client.command(pass_context = True)
async def all(ctx):
embed = discord.Embed(
colour = discord.Colour.red())
embed.set_author(name = 'All commands of PAPBot')
embed.add_field(name = '_hello', value = 'Says hello to the tagged member', inline = False)
embed.add_field(name = '_cgpacalc', value = 'Calculates your CGPA (pass Grade Score,Grade Score)', inline = False)
embed.add_field(name = '_showgpa', value = 'Returns your CGPA', inline = False)
embed.add_field(name = '_target', value = 'Tells you how much you need to score to achieve target(pass targetgpa,credits of next sem)', inline = False)
embed.add_field(name = '_updategpa', value = 'Updates your GPA (pass Grade Score,Grade Score)', inline = False)
embed.add_field(name = '_work', value = 'Starts the Pomodoro Timer', inline = False)
embed.add_field(name = '_takebreak', value = 'Starts the Break Timer', inline = False)
embed.add_field(name = '_add', value = 'Adds a task to your To-Do List', inline = False)
embed.add_field(name = '_done', value = 'Removes the completed task and updates your To-Do List', inline = False)
embed.add_field(name = '_show', value = 'Shows your current To-Do List', inline = False)
embed.add_field(name = '_add_deadline', value = 'Adds a Deadline', inline = False)
embed.add_field(name = '_remove_deadline', value = 'Removes a Deadline', inline = False)
embed.add_field(name = '_print_deadline', value = 'Prints information about your Deadline', inline = False)
embed.add_field(name = '_ball', value = 'Random game', inline = False)
embed.add_field(name = '_PAPbot', value = 'With love PAP', inline = False)
embed.add_field(name = '_poll', value = 'Helps create poll', inline = False)
embed.add_field(name = '_snl', value = 'Initiates the snake & ladder game', inline = False)
embed.add_field(name = '_move', value = 'Moves players position on the SNL board', inline = False)
embed.add_field(name = '_killsnl', value = 'Terminates Snakes and Ladders game', inline = False)
embed.add_field(name = '_tictactoe', value = 'Initiates TicTacToe game', inline = False)
embed.add_field(name = '_killgame', value = 'Terminates TicTacToe game', inline = False)
embed.add_field(name = '_Truth_or_Dare', value = 'Displays either a truth question or a dare', inline = False)
embed.add_field(name = '_task_completed', value = 'Displays your task completion status', inline = False)
embed.add_field(name = '_task_incomplete', value = 'Displays your task incompletion status', inline = False)
await ctx.send(embed = embed)
@client.command(pass_context=True)
async def info(ctx):
embed = discord.Embed(
colour = discord.Colour.purple())
embed.set_thumbnail(url= client.user.avatar_url)
embed.set_author(name = 'Information')
embed.add_field(name = 'What is it?', value = 'PAPbot is a discord bot made using `python`', inline = False)
embed.add_field(name = 'Hosting', value = 'Hosted on Heroku, currently in development stage', inline = False)
embed.add_field(name = 'Author', value = 'Made by `PAP`', inline = False)
await ctx.send(embed = embed)
client.run("OTUxODcyMDE2NDUyMDMwNDk2.Yitx5Q.3Ef9uXRpv6sQtsDIeSI0KGBw59M")