· 5 years ago · Jul 22, 2020, 04:06 AM
1import discord
2from discord.ext import commands
3import asyncio
4import datetime
5import sys
6import traceback
7import os
8from discord.utils import get
9import sqlite3
10
11client = discord.Client()
12
13bot = commands.Bot(command_prefix='>', description="Cedric Utility Command List", case_insensitive=True)
14bot.remove_command('help')
15
16@bot.event
17async def on_ready():
18 db = sqlite3.connect('main.sqlite')
19 cursor = db.cursor()
20 cursor.execute('''
21 CREATE TABLE IF NOT EXISTS main(
22 guild_id TEXT,
23 msg TEXT,
24 channel_id TEXT
25 )
26 ''')
27 print(f"Logged in as {bot.user} And connected to discord! (ID: {bot.user.id})")
28 return await bot.change_presence(activity=discord.Activity(type=1, name='Developers Mode', url='https://twitch.tv/twitch'))
29
30initial_extension = ['cogs.moderation',
31 'cogs.welcome',
32 'cogs.misc',
33 'cogs.help',
34 'cogs.filter',
35 'cogs.level',
36 'cogs.roles']
37
38if __name__ == '__main__':
39 for extension in initial_extension:
40 try:
41 bot.load_extension(extension)
42 except Exception as e:
43 print(f'Failed to load extension {extension}', file=sys.stderr)
44 traceback.print_exc()
45
46@bot.command(hidden=True)
47async def unload (ctx, *, module):
48 if ctx.message.author.id == 563287825882021893:
49 try:
50 bot.unload_extension(f"cogs.{module}")
51 except commands.ExtensionError as e:
52 await ctx.send(f'{e.__class__.__name__}: {e}')
53 else:
54 await ctx.send(f'<:true:734573835612848189> Reloaded {module} cogs')
55 else:
56 await ctx.send('Developer commands! you are not allowed to use this commands!')
57
58@bot.command(hidden=True)
59async def load (ctx, *, module):
60 if ctx.message.author.id == 563287825882021893:
61 try:
62 bot.load_extension(f"cogs.{module}")
63 except commands.ExtensionError as e:
64 await ctx.send(f'{e.__class__.__name__}: {e}')
65 else:
66 await ctx.send(f'<:true:734573835612848189> Reloaded {module} cogs')
67 else:
68 await ctx.send('Developer commands! you are not allowed to use this commands!')
69
70@bot.command(hidden=True)
71async def shutdown(ctx):
72 if ctx.message.author.id == 563287825882021893:
73 await ctx.message.channel.purge(limit=1)
74 await ctx.send('Developer Mode Bot has been shut down!')
75 await bot.logout()
76 else:
77 await ctx.message.channel.purge(limit=1)
78 await ctx.send('Developer commands! you are not allowed to use this commands!')
79
80async def react(message):
81 custom_emojis = ["✅"]
82 guild_emoji_names = [str(guild_emoji) for guild_emoji in message.guild.emojis]
83 for emoji in custom_emojis:
84 #print(emoji, guild_emoji_names)
85 #print(emoji in guild_emoji_names)
86 if emoji in guild_emoji_names:
87 await message.add_reaction(emoji)
88
89@bot.command(hidden=True)
90async def verify(ctx):
91 if ctx.channel.id == 724522314527539282:
92 embed = discord.Embed(title="Verify System", colour=discord.Colour(0xb1ff77), description="Verified this user below!")
93
94 embed.set_author(name="Cedric Utility", icon_url="https://images-ext-2.discordapp.net/external/GPwIJWF6RyGLjL72Ibrh2sBndXE9LBlFYCvblpA880s/https/images-ext-2.discordapp.net/external/KN7iWk8Dtxhgzd4467srldZVfb6-8ZvDKJExtpo2JHs/https/images-ext-2.discordapp.net/external/0dbDitfWOcsOPntD-zw19rcsAouwKqvxZeIKayzq-LE/https/cdn.discordapp.com/avatars/732026674694324254/de553adcc0bf69d15c4f0d1d13388aef.png")
95 embed.set_footer(text="Cedric Utility Verify System | Bugs may occur.", icon_url="https://images-ext-2.discordapp.net/external/GPwIJWF6RyGLjL72Ibrh2sBndXE9LBlFYCvblpA880s/https/images-ext-2.discordapp.net/external/KN7iWk8Dtxhgzd4467srldZVfb6-8ZvDKJExtpo2JHs/https/images-ext-2.discordapp.net/external/0dbDitfWOcsOPntD-zw19rcsAouwKqvxZeIKayzq-LE/https/cdn.discordapp.com/avatars/732026674694324254/de553adcc0bf69d15c4f0d1d13388aef.png")
96
97 embed.add_field(name="Members Name :", value=f"{ctx.message.author}")
98 embed.add_field(name="Members ID :", value=f"{ctx.message.author.id}")
99 role = discord.utils.get(ctx.author.guild.roles, id=609724829490216963)
100 await ctx.author.add_roles(role)
101 await ctx.message.add_reaction('✅')
102 await ctx.send(embed=embed)
103 else:
104 await ctx.send("You are already verified!")
105
106@bot.command(name='reload', hidden=True, invoke_without_command=True)
107async def _reload(ctx, *, module):
108 if ctx.message.author.id == 563287825882021893:
109 try:
110 bot.reload_extension(f"cogs.{module}")
111 except commands.ExtensionError as e:
112 await ctx.send(f'{e.__class__.__name__}: {e}')
113 else:
114 await ctx.send(f'<:true:734573835612848189> Reloaded {module} cogs')
115 else:
116 await ctx.send('Developer commands, you are not allowed to use this command!')
117
118bot.run("NzM1MzM4Mjc0NDYxMDU3MTE2.Xxe5yw.NPfbhbmUU2RL8XYm2o7X7VIJaRE")