Skip to content
This repository was archived by the owner on Jul 4, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pipenv
pipenv install
pip install flake8 pipenv
- name: Lint with flake8
run: |
flake8 . --count --ignore=E501,E722,C901 --select=E9,F63,F7,F82 --show-source --statistics
Expand Down
22 changes: 9 additions & 13 deletions cogs/ban_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,15 @@ def __init__(self, bot: commands.Bot) -> None:
@app_commands.command(name="ban_member", description="Banされたユーザー一覧を表示します。")
async def ban_members(self, i: discord.Interaction):
m = []
try:
if i.guild.channels.permissions_for(i.user) == discord.Permissions.ban_members:
if i.guild.channels.permissions_for(i.guild.get_member(self.bot.user.id)) == discord.Permissions.ban_members:
async for entry in i.guild.bans(limit=150):
m.append(f"{entry.user.name}, ")
send_content = "".join(m)
await i.response.send_message(send_content)
else:
await i.response.send_message("データを取得できませんでした(Botの権限がないなどの原因で)", ephemeral=True)
else:
await i.response.send_message("データを取得できませんでした(権限がないなどの原因で)", ephemeral=True)
except:
await i.response.send_message("データを取得できませんでした(権限がないなどの原因で)", ephemeral=True)
async for entry in i.guild.bans(limit=999999):
m.append(f"{entry.user.name}, ")
if not len(m) == 0:
end = len(m) - 1
m[end] = m[end].split(', ')[0]
send_content = "".join(m)
elif len(m) == 0:
send_content = "Banされたユーザーはいません。"
await i.response.send_message(send_content)


async def setup(bot: commands.Bot) -> None:
Expand Down
20 changes: 10 additions & 10 deletions cogs/role_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ def __init__(self, bot: commands.Bot) -> None:

@app_commands.describe(bot='Botにもロールを付与する?')
@app_commands.choices(bot=[
app_commands.Choice(name='はい', value=True),
app_commands.Choice(name='いいえ', value=False),
app_commands.Choice(name='はい', value="y"),
app_commands.Choice(name='いいえ', value="f"),
])
@app_commands.command(name="role_all_add", description="全メンバーにロールを付与します。")
async def roleall_add(self, i: discord.Interaction, role: discord.Role, bot: bool):
if bot:
async def roleall_add(self, i: discord.Interaction, role: discord.Role, bot: str):
if bot == 'y':
for member in i.guild.members:
await member.add_roles(role)
elif not bot:
elif bot == 'f':
for member in i.guild.members:
if not member.bot:
await member.add_roles(role)

@app_commands.describe(bot='Botのロールも除去する?')
@app_commands.choices(bot=[
app_commands.Choice(name='はい', value=True),
app_commands.Choice(name='いいえ', value=False),
app_commands.Choice(name='はい', value='y'),
app_commands.Choice(name='いいえ', value='f'),
])
@app_commands.command(name="role_all_remove", description="全員からロールを除去します。")
async def roleall_remove(self, i: discord.Interaction, role: discord.Role, bot: bool):
if bot:
async def roleall_remove(self, i: discord.Interaction, role: discord.Role, bot: str):
if bot == 'y':
for member in i.guild.members:
await member.remove_roles(role)
elif not bot:
elif bot == 'f':
for member in i.guild.members:
if not member.bot:
await member.remove_roles(role)
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def setup_hook(self):

bot = EightBot(
command_prefix="eg!",
intents=Intents(auto_moderation=False, typing=False),
intents=Intents.all(),
activity=Activity(
type=ActivityType.watching,
name="起動準備をしています...",
Expand Down