Skip to content

Commit d8bb20e

Browse files
committed
Remove extra newlines
1 parent 7f3a3b3 commit d8bb20e

File tree

1 file changed

+21
-46
lines changed

1 file changed

+21
-46
lines changed

main.py

Lines changed: 21 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,20 @@
2020
]
2121
console = False
2222
log = True
23-
if os.name == 'nt':
24-
os.system('cls')
25-
else:
26-
os.system('clear')
23+
if os.name == 'nt': os.system('cls')
24+
else: os.system('clear')
2725
print('Checking for rate limit errors...')
2826
r = requests.head(url="https://discord.com/api/v1")
2927
try:
3028
print(f"Rate limit error found: {int(r.headers['Retry-After']) / 60} minutes left")
3129
raise(SystemExit)
32-
except:
33-
print("No rate limit found.")
30+
except: print("No rate limit found.")
3431
time.sleep(1)
3532
intents = discord.Intents.all()
3633
errHandlerVer = 'v2.4'
3734
botVer = 'v1.0'
38-
if os.name == 'nt':
39-
os.system('cls')
40-
else:
41-
os.system('clear')
35+
if os.name == 'nt': os.system('cls')
36+
else: os.system('clear')
4237
owner = '@notsniped'
4338
homedir = os.path.expanduser("~")
4439
client = commands.Bot(command_prefix="+", intents=intents)
@@ -59,26 +54,15 @@ class colors:
5954
green = '\033[92m'
6055
end = '\033[0m'
6156

62-
with open('database/count.json', 'r') as f:
63-
global count
64-
count = json.load(f)
65-
with open('database/configuration/countchannel.json', 'r') as f:
66-
global countchannel
67-
countchannel = json.load(f)
68-
with open('database/configuration/warning.json', 'r') as f:
69-
global warnmsg
70-
warnmsg = json.load(f)
71-
with open('database/configuration/autoreactions.json', 'r') as f:
72-
global autoreactions
73-
autoreactions = json.load(f)
57+
with open('database/count.json', 'r') as f: count = json.load(f)
58+
with open('database/configuration/countchannel.json', 'r') as f: countchannel = json.load(f)
59+
with open('database/configuration/warning.json', 'r') as f: warnmsg = json.load(f)
60+
with open('database/configuration/autoreactions.json', 'r') as f: autoreactions = json.load(f)
7461

7562
def savedata():
76-
with open('database/count.json', 'w+') as f:
77-
json.dump(count, f)
78-
with open('database/configuration/countchannel.json', 'w+') as f:
79-
json.dump(countchannel, f)
80-
with open('database/configuration/autoreactions.json', 'w+') as f:
81-
json.dump(autoreactions, f)
63+
with open('database/count.json', 'w+') as f: json.dump(count, f)
64+
with open('database/configuration/countchannel.json', 'w+') as f: json.dump(countchannel, f)
65+
with open('database/configuration/autoreactions.json', 'w+') as f: json.dump(autoreactions, f)
8266

8367
def get_time():
8468
now = datetime.datetime.now()
@@ -87,10 +71,8 @@ def get_time():
8771
# Events
8872
@client.event
8973
async def on_ready():
90-
if os.name == 'nt':
91-
os.system('cls')
92-
else:
93-
os.system('clear')
74+
if os.name == 'nt': os.system('cls')
75+
else: os.system('clear')
9476
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.playing, name=f"the epic comeback. (+help) | {str(len(client.guilds))} guilds"))
9577
print('Bot is online')
9678
print('==================')
@@ -119,8 +101,7 @@ async def on_ready():
119101
print('Bot admins')
120102
print('------------------')
121103
print(colors.cyan)
122-
for id in ids:
123-
print(id)
104+
for id in ids: print(id)
124105
print(colors.end)
125106
print('==================')
126107
print('System info')
@@ -156,53 +137,47 @@ async def on_command_error(ctx, error):
156137
f.write(f'[{current_time}/WARN] Ignoring exception at CommandNotFound. Details: This command does not exist.\n')
157138
f.close()
158139
print(f'{colors.red}[{current_time}/WARN] Ignoring exception at CommandNotFound. Details: This command does not exist.{colors.end}')
159-
else:
160-
pass
140+
else: pass
161141
if isinstance(error, discord.ext.commands.CommandOnCooldown):
162142
await ctx.send(f':warning: This command is currently on cooldown, try after **{str(datetime.timedelta(seconds=int(round(error.retry_after))))}**', delete_after=5)
163143
if os.name == 'nt':
164144
with open(errorHandler_path, 'a') as f:
165145
f.write(f'[{current_time}/WARN] Ignoring exception at CommandOnCooldown. Details: This command is currently on cooldown.\n')
166146
f.close()
167147
print(f'{colors.red}[{current_time}/WARN] Ignoring exception at CommandOnCooldown. Details: This command is currently on cooldown.{colors.end}')
168-
else:
169-
pass
148+
else: pass
170149
if isinstance(error, discord.ext.commands.MissingRequiredArgument):
171150
await ctx.send(':x: Your command has missing required argument(s).', delete_after=3)
172151
if os.name == 'nt':
173152
with open(errorHandler_path, 'a') as f:
174153
f.write(f'[{current_time}/WARN] Ignoring exception at MissingRequiredArgument. Details: The command can\'t be executed because required arguments are missing.\n')
175154
f.close()
176155
print(f'{colors.red}[{current_time}/WARN] Ignoring exception at MissingRequiredArgument. Details: The command can\'t be executed because required arguments are missing.{colors.end}')
177-
else:
178-
pass
156+
else: pass
179157
if isinstance(error, discord.ext.commands.MissingPermissions):
180158
await ctx.send(':x: You don\'t have permissions to use this command.', delete_after=3)
181159
if os.name == 'nt':
182160
with open(errorHandler_path, 'a') as f:
183161
f.write(f'[{current_time}/WARN] Ignoring exception at MissingPermissions. Details: The user doesn\'t have the required permissions.\n')
184162
f.close()
185163
print(f'{colors.red}[{current_time}/WARN] Ignoring exception at MissingPermissions. Details: The user doesn\'t have the required permissions.{colors.end}')
186-
else:
187-
pass
164+
else: pass
188165
if isinstance(error, discord.ext.commands.BadArgument):
189166
await ctx.send(':x: Invalid argument.', delete_after=3)
190167
if os.name == 'nt':
191168
with open(errorHandler_path, 'a') as f:
192169
f.write(f'[{current_time}/WARN] Ignoring exception at BadArgument.\n')
193170
f.close()
194171
print(f'{colors.red}[{current_time}/WARN] Ignoring exception at BadArgument.{colors.end}')
195-
else:
196-
pass
172+
else: pass
197173
if isinstance(error, discord.ext.commands.BotMissingPermissions):
198174
await ctx.send(':x: I don\'t have permissions to do this. Kindly manage my role permissions to get this feature working.')
199175
if os.name == 'nt':
200176
with open(errorHandler_path, 'a') as f:
201177
f.write(f'[{current_time}/WARN] Ignoring exception at BotMissingPermissions.\n Details: The bot doesn\'t have the required permissions.\n')
202178
f.close()
203179
print(f'{colors.red}[{current_time}/WARN] Ignoring exception at BotMissingPremissions. Details: The bot doesn\'t have the required permissions.{colors.end}')
204-
else:
205-
pass
180+
else: pass
206181

207182
snipe_message_author = {}
208183
snipe_message_content = {}

0 commit comments

Comments
 (0)