Skip to content

Commit

Permalink
Merge pull request #63 from tetsuya-ki/bugfix/#62
Browse files Browse the repository at this point in the history
Bugfix/#62
  • Loading branch information
tetsuya-ki authored Feb 25, 2021
2 parents 6daca7d + 588ccd7 commit 0eb0c71
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cogs/modules/ohgiri.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class OhgiriMember:
大喜利参加者クラス
"""
def __init__(self):
self.point = 0
self.point = 0
self.cards = [] # カードのID
self.answered = False

Expand Down Expand Up @@ -166,7 +166,7 @@ def receive_card(self, card_id, member, second_card_id=None):
if answer.second_card_id is not None:
self.members[member].cards.append(answer.second_card_id)
break
self.field = [answer for answer in self.field if answer.member != member]
self.field = [answer for answer in self.field if answer.member != member]

# 回答済に設定する
self.members[member].answered = True
Expand Down
2 changes: 1 addition & 1 deletion cogs/modules/radiko.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def convert_prefCd(self, prefName):

def convert_filter(self, filter):
if '未来' in filter or 'future' in filter:
return 'future'
return 'future'
elif '過去' in filter or 'past' in filter:
return 'past'
else:
Expand Down
10 changes: 6 additions & 4 deletions cogs/modules/reactionchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def get_discord_attachment_file(self):
if get_control_channel is not None:
last_message = await get_control_channel.history(limit=1).flatten()
logger.debug(f'++++{last_message}++++')
if len(last_message) != 0:
if len(last_message) != 0:
logger.debug(f'len: {len(last_message)}, con: {last_message[0].content}, attchSize:{len(last_message[0].attachments)}')
if Attachment_file_date is not None:
logger.debug(f'date: {Attachment_file_date} <<<<<<< {last_message[0].created_at}, {Attachment_file_date < last_message[0].created_at}')
Expand Down Expand Up @@ -141,8 +141,9 @@ async def set_rc(self, guild:discord.Guild):
serialize = dict["pickle"]
reaction_channels = pickle.loads(base64.b64decode(serialize.encode()))

# Wenhook対応
reaction_channeler_permit_webhook_id_list = settings.REACTION_CHANNELER_PERMIT_WEBHOOK_ID.replace(' ', '').split(';')
# Webhook対応
reaction_channeler_permit_webhook_ids = '' if settings.REACTION_CHANNELER_PERMIT_WEBHOOK_ID is None else settings.REACTION_CHANNELER_PERMIT_WEBHOOK_ID
reaction_channeler_permit_webhook_id_list = reaction_channeler_permit_webhook_ids.replace(' ', '').split(';')
for rc in reaction_channels:
# rc[3](チャンネル名が入るところ)が空ではない場合、通常のリアクションチャンネラーのためそのまま追加。そうではない場合はWebhookのため、有効か確認する
if rc[3] != '':
Expand Down Expand Up @@ -270,7 +271,8 @@ async def add(self, ctx, reaction:str, channel:str):
if is_webhook:
# 環境変数に登録されているものかチェック
ch_guild_id = str(re.search(self.WEBHOOK_URL+r'(\d+)/', channel).group(1))
reaction_channeler_permit_webhook_id_list = settings.REACTION_CHANNELER_PERMIT_WEBHOOK_ID.replace(' ', '').split(';')
reaction_channeler_permit_webhook_ids = '' if settings.REACTION_CHANNELER_PERMIT_WEBHOOK_ID is None else settings.REACTION_CHANNELER_PERMIT_WEBHOOK_ID
reaction_channeler_permit_webhook_id_list = reaction_channeler_permit_webhook_ids.replace(' ', '').split(';')
l_in = [s for s in reaction_channeler_permit_webhook_id_list if (ch_guild_id or 'all') in s.lower()]
# 環境変数に登録されていないものの場合、先頭に「※」を付与
add_messsage = ''
Expand Down
2 changes: 1 addition & 1 deletion cogs/modules/scrapboxsidandpnames.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def check(self, message:discord.Message):
self.target_sid = scrapboxSidAndPnamesTarget.scrapbox_sid
return True
return False

async def expand(self, message:discord.Message):
rurl = r'https://' + self.SCRAPBOX_URL_PATTERN + self.target_project + '/([\w/:%#$&?\(\)~\.=\+-]+)'
cookies={"connect.sid" : self.target_sid}
Expand Down
4 changes: 2 additions & 2 deletions cogs/reactionchannelercog.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
return
if payload.emoji.name == '👌':# ok_handは確認に使っているので無視する(と思っていたが別機能として使用)
await self.save_file(payload)
return
return
await self.pin_message(payload)
await self.reaction_channeler(payload)

Expand Down Expand Up @@ -230,7 +230,7 @@ async def reaction_channeler(self, payload: discord.RawReactionActionEvent):
except (discord.HTTPException,discord.NotFound,discord.Forbidden,discord.InvalidArgument) as e:
logger.error(e)
elif '※' in reaction[1]:
logger.info('環境変数に登録されていないギルドIDをもつWebhookのため、実行されませんでした。')
logger.info('環境変数に登録されていないWebhookIDをもつWebhookのため、実行されませんでした。')
# 通常のリアクションチャンネラー機能の実行
else:
to_channel = guild.get_channel(int(reaction[2]))
Expand Down

0 comments on commit 0eb0c71

Please sign in to comment.