Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Apr 27, 2022. It is now read-only.
Addrole to kawae - #138
Merged
Merged
Conversation
isso0424
suggested changes
Jun 16, 2020
| async def on_guild_role_create(self, role): | ||
| pass | ||
| await add_role_to_kawae(load_config(), role) |
Member
There was a problem hiding this comment.
なんで毎回load_config()を呼び出してるんですか...?
これメンバ変数にコンフィグを持ったり、roleに対して静的変数として定数を置いておいたほうがよくね
| async def add_role_to_kawae( | ||
| config: Dict[str, Dict[str, Union[str, int]]], |
| config: Dict[str, Dict[str, Union[str, int]]], | ||
| role: discord.Role | ||
| ): | ||
| user: discord.Member = role.guild.get_member(config["add_role"]["user_id"]) |
Member
There was a problem hiding this comment.
これclassにしてmemberをメンバ変数として持っておきません?
isso0424
suggested changes
Jun 16, 2020
| async def on_guild_role_create(self, role): | ||
| pass | ||
| role: discord.Role | ||
| ): | ||
| user: discord.Member = role.guild.get_member(config["add_role"]["user_id"]) | ||
| notify_channel: discord.TextChannel = role.guild.get_channel(config["text_channel"]["base"]) |
| user: discord.Member = role.guild.get_member(config["add_role"]["user_id"]) | ||
| notify_channel: discord.TextChannel = role.guild.get_channel(config["text_channel"]["base"]) | ||
| await user.add_roles(role) | ||
| await notify_channel.send(role.mention + "ですが、かわえにも追加しておきました") |
loxygenK
commented
Jun 16, 2020
ContributorAuthor
なんでクラスにしなかったんですかね、たぶんプログラミング苦手だからだと思うんですけど |
isso0424
suggested changes
Jun 16, 2020
| ): | ||
| await self.kawae_member.add_roles(role_to_add) | ||
| await self.notify_channel.send( | ||
| "{}ですが、{}にも追加しておきました".format(role_to_add.mention, self.kawae_member.mention) |
Member
There was a problem hiding this comment.
HARD CODING
hibikiness追加が面倒になるのでやめて
| class KawaemonRoleAdder: | ||
| def __init__(self, client: discord.Client, kawae_user_id: int, announce_text_channel_id: int): |
isso0424
approved these changes
Jun 16, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
短いコードですがReqChangeを授かる自信があります