-
-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
src/client.py
Outdated
| async def on_guild_role_create(self, role): | ||
| pass | ||
|
|
||
| await add_role_to_kawae(load_config(), role) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なんで毎回load_config()を呼び出してるんですか...?
これメンバ変数にコンフィグを持ったり、roleに対して静的変数として定数を置いておいたほうがよくね
src/on_role_created/role.py
Outdated
|
|
||
|
|
||
| async def add_role_to_kawae( | ||
| config: Dict[str, Dict[str, Union[str, int]]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
必要なconfigだけ受け取ろう
src/on_role_created/role.py
Outdated
| config: Dict[str, Dict[str, Union[str, int]]], | ||
| role: discord.Role | ||
| ): | ||
| user: discord.Member = role.guild.get_member(config["add_role"]["user_id"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これclassにしてmemberをメンバ変数として持っておきません?
|
|
||
| async def on_guild_role_create(self, role): | ||
| pass | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
またこの人末尾の改行消してる...
src/on_role_created/role.py
Outdated
| 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"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なんで一回一回読み込むんですか...?
src/on_role_created/role.py
Outdated
| 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 + "ですが、かわえにも追加しておきました") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatしたくない...?
|
なんでクラスにしなかったんですかね、たぶんプログラミング苦手だからだと思うんですけど |
isso0424
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
req
src/on_role_created/role.py
Outdated
| ): | ||
| await self.kawae_member.add_roles(role_to_add) | ||
| await self.notify_channel.send( | ||
| "{}ですが、{}にも追加しておきました".format(role_to_add.mention, self.kawae_member.mention) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HARD CODING
hibikiness追加が面倒になるのでやめて
src/on_role_created/role.py
Outdated
|
|
||
| class KawaemonRoleAdder: | ||
|
|
||
| def __init__(self, client: discord.Client, kawae_user_id: int, announce_text_channel_id: int): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clientをたらい回しすんな
短いコードですがReqChangeを授かる自信があります