Skip to content
This repository has been archived by the owner on Sep 17, 2020. It is now read-only.

Commit

Permalink
support 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
XuaTheGrate committed Feb 5, 2020
1 parent b52c5a5 commit 8674988
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ async def global_check(self, ctx):

def get_command(self, name):
# patch this to support commands prefixed with space
if (c := self.all_commands.get(name)):
c = self.all_commands.get(name)
if c:
return c
return super().get_command(name)

Expand Down
6 changes: 3 additions & 3 deletions cogs/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import re
import textwrap
import time
from ast import PyCF_ALLOW_TOP_LEVEL_AWAIT
from pprint import pformat
from typing import Union

Expand Down Expand Up @@ -239,7 +238,7 @@ async def eval(self, ctx, *, code_string):
import_expression.constants.IMPORTER: importlib.import_module})
self._env['ctx'] = ctx
try:
expr = import_expression.compile(code_string, flags=PyCF_ALLOW_TOP_LEVEL_AWAIT)
expr = import_expression.compile(code_string)
ret = eval(expr, self._env)
except SyntaxError:
pass
Expand Down Expand Up @@ -369,7 +368,8 @@ async def in_(self, ctx, channel: discord.TextChannel, *, command):

@dev.command(name='at')
async def at_(self, ctx, guild_id: int, *, command):
if not (guild := self.bot.get_guild(guild_id)):
guild = self.bot.get_guild(guild_id)
if not guild:
return await ctx.send('no guild found')
nmsg = copy.copy(ctx.message)
nmsg.guild = guild
Expand Down
3 changes: 2 additions & 1 deletion cogs/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ async def list(self, ctx):
return await ctx.send("Not enough materials to craft anything \N{CONFUSED FACE}. "
"Try opening some treasures to find materials.")
pg = EmbedPaginator()
if len(dt := '\n'.join(k)) > 2048:
dt = '\n'.join(k)
if len(k) > 2048:
for chunk in [k[x:x+20] for x in range(0, len(dt), 20)]:
pg.add_page(discord.Embed(description='\n'.join(chunk)))
else:
Expand Down
3 changes: 2 additions & 1 deletion cogs/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ async def interact(self, ctx):
valid = [x['id'] for x in ctx.player.map.areas[ctx.player.area]['interactions'] if x['type'] == 1]
chest_ids = await self.bot.redis.hgetall(f'open_chests:{ctx.author.id}')
for cid in chest_ids.keys():
if (i := int(cid)) in valid:
i = int(cid)
if i in valid:
valid.remove(i)
it = []
for v in (i for i in ctx.player.map.areas[ctx.player.area]['interactions']
Expand Down
3 changes: 2 additions & 1 deletion cogs/utils/battle.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,8 @@ async def post_battle_complete(self):
await self.cmd(self.ctx, err, battle=self)
return

if (p := self.players[0]).is_fainted():
p = self.players[0]
if p.is_fainted():
# TODO: reset map back to first map and lose some cash
await self.ctx.send("ok so theres supposed to be some magic script thing but i cant figure it out\n"
"ill heal you and then kick you from battle because i havent fixed it yet")
Expand Down
3 changes: 2 additions & 1 deletion cogs/utils/targetting.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ async def select_skill(self, _, skill):
if skill.lower() == 'guard':
self.result = {"type": "fight", "data": {"skill": obj}}
return await self.stop()
if (target := await self.select_target(obj.target)) != 'cancel':
target = await self.select_target(obj.target)
if target != 'cancel':
self.result = {"type": "fight", "data": {"skill": obj, "targets": target}}
# log.debug(f"select skill: {self.result}")
await self.stop()
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
git+https://github.com/Rapptz/discord.py
discord.py
PyNaCl ; sys_platform == 'linux'
import-expression==0.4.0.post1
psutil
Expand Down

0 comments on commit 8674988

Please sign in to comment.