Skip to content
This repository was archived by the owner on Apr 27, 2022. It is now read-only.

Addrole to kawae - #138

Merged
loxygenK merged 6 commits into
newHarachofrom
addrole_to_kawae
Jun 16, 2020
Merged

Addrole to kawae#138
loxygenK merged 6 commits into
newHarachofrom
addrole_to_kawae

Conversation

@loxygenK

Copy link
Copy Markdown
Contributor

短いコードですがReqChangeを授かる自信があります

@loxygenK
loxygenK requested a review from isso0424June 16, 2020 06:31
Comment threadsrc/client.py Outdated
async def on_guild_role_create(self, role):
pass

await add_role_to_kawae(load_config(), role)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なんで毎回load_config()を呼び出してるんですか...?
これメンバ変数にコンフィグを持ったり、roleに対して静的変数として定数を置いておいたほうがよくね

Comment threadsrc/on_role_created/role.py Outdated


async def add_role_to_kawae(
config: Dict[str, Dict[str, Union[str, int]]],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

必要なconfigだけ受け取ろう

Comment threadsrc/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"])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これclassにしてmemberをメンバ変数として持っておきません?

Comment threadsrc/client.py

async def on_guild_role_create(self, role):
pass

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

またこの人末尾の改行消してる...

Comment threadsrc/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"])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なんで一回一回読み込むんですか...?

Comment threadsrc/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 + "ですが、かわえにも追加しておきました")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatしたくない...?

@loxygenK

Copy link
Copy Markdown
ContributorAuthor

なんでクラスにしなかったんですかね、たぶんプログラミング苦手だからだと思うんですけど

@isso0424isso0424 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

req

Comment threadsrc/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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HARD CODING
hibikiness追加が面倒になるのでやめて

Comment threadsrc/on_role_created/role.py Outdated

class KawaemonRoleAdder:

def __init__(self, client: discord.Client, kawae_user_id: int, announce_text_channel_id: int):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clientをたらい回しすんな

@loxygenK
loxygenK merged commit 4e72114 into newHarachoJun 16, 2020
@MikuroXina
MikuroXina deleted the addrole_to_kawae branch March 22, 2021 14:05
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@loxygenK@isso0424