|
1 | | -### Modules ### |
| 1 | +# Imports |
2 | 2 | import os |
3 | 3 | import time |
4 | 4 | import os.path |
|
10 | 10 | from discord.ext import commands |
11 | 11 | from discord.ext.commands import * |
12 | 12 | from discord.ext import tasks |
13 | | -### Modules end ### |
14 | 13 |
|
15 | | -### Startup/variables ### |
| 14 | +# Startup and Variables |
16 | 15 | ids = [ |
17 | 16 | 816941773032390676, |
18 | 17 | 738290097170153472, |
|
46 | 45 | global startTime |
47 | 46 | startTime = time.time() |
48 | 47 | client.remove_command('help') |
49 | | -### Startup\\variables end ### |
50 | | - |
51 | | -### Command variables ### |
52 | 48 | theme_color = 0xffbd59 |
53 | 49 | color_success = 0x77b255 |
54 | 50 | color_fail = 0xc92424 |
55 | 51 | rootdir = 'C://Users//dhruvbhat//OneDrive//Desktop//increment.io' |
56 | 52 | loggerHandler_path = 'botLog/log.txt' |
57 | 53 | errorHandler_path = 'botLog/errors.txt' |
58 | | -### Functions and classes ### |
59 | | - |
60 | 54 | correctnumber = {} |
61 | 55 |
|
62 | 56 | class colors: |
@@ -90,9 +84,7 @@ def get_time(): |
90 | 84 | now = datetime.datetime.now() |
91 | 85 | return now.strftime("%H:%M:%S") |
92 | 86 |
|
93 | | -### Functions and classes end ### |
94 | | - |
95 | | -## Events ### |
| 87 | +# Events |
96 | 88 | @client.event |
97 | 89 | async def on_ready(): |
98 | 90 | if os.name == 'nt': |
@@ -153,7 +145,7 @@ async def on_ready(): |
153 | 145 | print('Bot file size: ' + os.path.getsize(str(os.getcwd() + '\\main.py'))) |
154 | 146 | print('------------------') |
155 | 147 |
|
156 | | -# Error handler # |
| 148 | +# Error Handler |
157 | 149 | @client.event |
158 | 150 | async def on_command_error(ctx, error): |
159 | 151 | now = datetime.datetime.now() |
@@ -211,7 +203,6 @@ async def on_command_error(ctx, error): |
211 | 203 | print(f'{colors.red}[{current_time}/WARN] Ignoring exception at BotMissingPremissions. Details: The bot doesn\'t have the required permissions.{colors.end}') |
212 | 204 | else: |
213 | 205 | pass |
214 | | -# Error handler end # |
215 | 206 |
|
216 | 207 | snipe_message_author = {} |
217 | 208 | snipe_message_content = {} |
@@ -254,10 +245,7 @@ async def on_message(message): |
254 | 245 | else: pass |
255 | 246 | await client.process_commands(message) |
256 | 247 |
|
257 | | -### Events end ### |
258 | | - |
259 | | -### Commands ### |
260 | | - |
| 248 | +# Commands |
261 | 249 | @client.command() |
262 | 250 | async def uptime(ctx): |
263 | 251 | uptime = str(datetime.timedelta(seconds=int(round(time.time()-startTime)))) |
@@ -289,10 +277,7 @@ async def serverstats(ctx): |
289 | 277 | emb12.set_thumbnail(url=servericon) |
290 | 278 | await ctx.send(embed = emb12) |
291 | 279 |
|
292 | | -## Moderation Commands End ## |
293 | | - |
294 | | -## Count Commands ## |
295 | | - |
| 280 | +# Count Commands |
296 | 281 | @client.command() |
297 | 282 | @commands.has_permissions(administrator = True) |
298 | 283 | async def setchannel(ctx): |
@@ -334,8 +319,6 @@ async def resetcount(ctx): |
334 | 319 | savedata() |
335 | 320 | await ctx.reply(':white_check_mark: Count successfully reset back to `1`') |
336 | 321 |
|
337 | | -## Count Commands End ## |
338 | | - |
339 | | -### Commands end ### |
| 322 | +# Client initialization |
340 | 323 | keep_alive() |
341 | 324 | client.run('') # Insert your bot token here |
0 commit comments