Skip to content

Commit d19a510

Browse files
committed
Spacing
1 parent 7e6b973 commit d19a510

File tree

4 files changed

+46
-39
lines changed

4 files changed

+46
-39
lines changed

bot.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
from core.thread import ThreadManager
5353
from core.time import human_timedelta
5454

55-
5655
init()
5756

5857
logger = logging.getLogger('Modmail')
@@ -486,7 +485,8 @@ async def process_modmail(self, message):
486485
except isodate.ISO8601Error:
487486
logger.warning('The account age limit needs to be a '
488487
'ISO-8601 duration formatted duration string '
489-
f'greater than 0 days, not "%s".', str(account_age))
488+
f'greater than 0 days, not "%s".',
489+
str(account_age))
490490
del self.config.cache['account_age']
491491
await self.config.update()
492492
account_age = isodate.duration.Duration()
@@ -541,7 +541,7 @@ async def process_modmail(self, message):
541541
await self.config.update()
542542
else:
543543
reaction = sent_emoji
544-
544+
545545
if reaction != 'disable':
546546
try:
547547
await message.add_reaction(reaction)
@@ -610,7 +610,9 @@ async def update_perms(self, name, value, add=True):
610610
else:
611611
if value in permissions[name]:
612612
permissions[name].remove(value)
613-
logger.info(info(f'Updating permissions for {name}, {value} (add={add}).'))
613+
logger.info(
614+
info(f'Updating permissions for {name}, {value} (add={add}).')
615+
)
614616
await self.config.update()
615617

616618
async def on_message(self, message):
@@ -649,7 +651,7 @@ async def on_message(self, message):
649651

650652
async def on_typing(self, channel, user, _):
651653
if user.bot:
652-
return
654+
return
653655
if isinstance(channel, discord.DMChannel):
654656
if not self.config.get('user_typing'):
655657
return
@@ -662,7 +664,7 @@ async def on_typing(self, channel, user, _):
662664
thread = await self.threads.find(channel=channel)
663665
if thread and thread.recipient:
664666
await thread.recipient.trigger_typing()
665-
667+
666668
async def on_raw_reaction_add(self, payload):
667669

668670
user = self.get_user(payload.user_id)
@@ -682,12 +684,14 @@ async def on_raw_reaction_add(self, payload):
682684
message = await channel.get_message(payload.message_id)
683685
reaction = payload.emoji
684686

685-
close_emoji = await self.convert_emoji(self.config.get('close_emoji', '🔒'))
687+
close_emoji = await self.convert_emoji(
688+
self.config.get('close_emoji', '🔒')
689+
)
686690

687691
if isinstance(channel, discord.DMChannel) and str(reaction) == str(close_emoji): # closing thread
688692
thread = await self.threads.find(recipient=user)
689693
ts = message.embeds[0].timestamp if message.embeds else None
690-
if thread and ts == thread.channel.created_at:
694+
if thread and ts == thread.channel.created_at:
691695
# the reacted message is the corresponding thread creation embed
692696
if not self.config.get('disable_recipient_thread_close'):
693697
await thread.close(closer=user)
@@ -733,23 +737,23 @@ async def on_guild_channel_delete(self, channel):
733737
return
734738

735739
await thread.close(closer=mod, silent=True, delete_channel=False)
736-
740+
737741
async def on_member_remove(self, member):
738742
thread = await self.threads.find(recipient=member)
739743
if thread:
740744
em = discord.Embed(
741745
description='The recipient has left the server.',
742746
color=discord.Color.red()
743-
)
747+
)
744748
await thread.channel.send(embed=em)
745-
749+
746750
async def on_member_join(self, member):
747751
thread = await self.threads.find(recipient=member)
748752
if thread:
749753
em = discord.Embed(
750754
description='The recipient has joined the server.',
751755
color=self.mod_color
752-
)
756+
)
753757
await thread.channel.send(embed=em)
754758

755759
async def on_message_delete(self, message):
@@ -909,7 +913,7 @@ async def autoupdate_loop(self):
909913
embed.set_author(name=user['username'] + ' - Updating Bot',
910914
icon_url=user['avatar_url'],
911915
url=user['url'])
912-
embed.set_footer(text=f"Updating Modmail v{self.version} "
916+
embed.set_footer(text=f'Updating Modmail v{self.version} '
913917
f"-> v{metadata['latest_version']}")
914918

915919
changelog = await Changelog.from_url(self)
@@ -935,6 +939,7 @@ async def autoupdate_loop(self):
935939
if __name__ == '__main__':
936940
if os.name != 'nt':
937941
import uvloop
942+
938943
uvloop.install()
939944
bot = ModmailBot()
940945
bot.run()

cogs/utility.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,9 @@ async def activity(self, ctx, activity_type: str.lower, *, message: str = ''):
442442
raise commands.UserInputError
443443

444444
activity, msg = (await self.set_presence(
445-
activity_identifier=activity_type,
446-
activity_by_key=True,
447-
activity_message=message
445+
activity_identifier=activity_type,
446+
activity_by_key=True,
447+
activity_message=message
448448
))['activity']
449449
if activity is None:
450450
raise commands.UserInputError
@@ -488,8 +488,8 @@ async def status(self, ctx, *, status_type: str.lower):
488488
status_type = status_type.replace(' ', '_')
489489

490490
status, msg = (await self.set_presence(
491-
status_identifier=status_type,
492-
status_by_key=True
491+
status_identifier=status_type,
492+
status_by_key=True
493493
))['status']
494494
if status is None:
495495
raise commands.UserInputError

core/checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async def predicate(ctx):
3737
return commands.check(predicate)
3838

3939

40-
async def check_permissions(ctx: commands.Context,
40+
async def check_permissions(ctx: commands.Context,
4141
command_name: str,
4242
permission_level: PermissionLevel) -> bool:
4343
if await ctx.bot.is_owner(ctx.author):

core/thread.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from core.utils import is_image_url, days, match_user_id
1313
from core.utils import truncate, ignore, error
1414

15-
1615
logger = logging.getLogger('Modmail')
1716

1817

@@ -104,12 +103,12 @@ async def setup(self, *, creator=None, category=None):
104103
try:
105104
log_url, log_data = await asyncio.gather(
106105
self.bot.api.create_log_entry(recipient, channel,
107-
creator or recipient),
106+
creator or recipient),
108107
self.bot.api.get_user_logs(recipient.id)
109108
)
110109

111110
log_count = sum(1 for log in log_data if not log['open'])
112-
except: # Something went wrong with database?
111+
except: # Something went wrong with database?
113112
log_url = log_count = None
114113
# ensure core functionality still works
115114

@@ -153,14 +152,15 @@ async def send_info_embed():
153152

154153
footer = self.bot.config.get('thread_creation_footer', footer)
155154
embed.set_footer(text=footer, icon_url=self.bot.guild.icon_url)
156-
embed.title = self.bot.config.get('thread_creation_title', 'Thread Created')
155+
embed.title = self.bot.config.get('thread_creation_title',
156+
'Thread Created')
157157

158158
if creator is None:
159159
msg = await recipient.send(embed=embed)
160160
if not self.bot.config.get('disable_recipient_thread_close'):
161161
close_emoji = self.bot.config.get('close_emoji', '🔒')
162162
close_emoji = await self.bot.convert_emoji(close_emoji)
163-
await msg.add_reaction(close_emoji)
163+
await msg.add_reaction(close_emoji)
164164

165165
def _close_after(self, closer, silent, delete_channel, message):
166166
return self.bot.loop.create_task(
@@ -245,7 +245,7 @@ async def _close(self, closer, silent=False, delete_channel=True,
245245
user = f"{self.recipient} (`{self.id}`)"
246246
else:
247247
user = f'`{self.id}`'
248-
248+
249249
if self.id == closer.id:
250250
_closer = 'the Recipient'
251251
else:
@@ -261,34 +261,37 @@ async def _close(self, closer, silent=False, delete_channel=True,
261261
tasks = [
262262
self.bot.config.update()
263263
]
264-
264+
265265
try:
266266
tasks.append(self.bot.log_channel.send(embed=embed))
267267
except (ValueError, AttributeError):
268268
pass
269269

270270
# Thread closed message
271271

272-
embed = discord.Embed(title=self.bot.config.get('thread_close_title', 'Thread Closed'),
273-
color=discord.Color.red(),
274-
timestamp=datetime.utcnow())
272+
embed = discord.Embed(
273+
title=self.bot.config.get('thread_close_title', 'Thread Closed'),
274+
color=discord.Color.red(),
275+
timestamp=datetime.utcnow())
275276

276277
if not message:
277278
if self.id == closer.id:
278279
message = self.bot.config.get(
279-
'thread_self_close_response',
280+
'thread_self_close_response',
280281
'You have closed this Modmail thread.'
281-
)
282+
)
282283
else:
283284
message = self.bot.config.get(
284285
'thread_close_response',
285286
'{closer.mention} has closed this Modmail thread.'
286-
)
287-
288-
message = message.format(closer=closer, loglink=log_url, logkey=log_data['key'])
287+
)
288+
289+
message = message.format(closer=closer, loglink=log_url,
290+
logkey=log_data['key'])
289291

290292
embed.description = message
291-
footer = self.bot.config.get('thread_close_footer', 'Replying will create a new thread')
293+
footer = self.bot.config.get('thread_close_footer',
294+
'Replying will create a new thread')
292295
embed.set_footer(text=footer,
293296
icon_url=self.bot.guild.icon_url)
294297

@@ -476,13 +479,12 @@ async def send(self, message, destination=None,
476479

477480
for att in images:
478481
if not prioritize_uploads or (
479-
is_image_url(*att) and not
480-
embedded_image and
481-
att[1]
482+
is_image_url(*att) and not embedded_image and att[1]
482483
):
483484
embed.set_image(url=att[0])
484485
if att[1]:
485-
embed.add_field(name='Image', value=f'[{att[1]}]({att[0]})')
486+
embed.add_field(name='Image',
487+
value=f'[{att[1]}]({att[0]})')
486488
embedded_image = True
487489
elif att[1] is not None:
488490
if note:

0 commit comments

Comments
 (0)