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
Show all changes
37 commits
Select commit Hold shift + click to select a range
6b2ecd3
new: verify_callbackとverifyを合体した, afk追加, userinfoの引数に説明追加
gx1285 Oct 16, 2022
86f78da
new: afkを解除するためのコマンド
gx1285 Oct 16, 2022
2fc3941
fix: Flake8 Lintに引っかからないように
gx1285 Oct 16, 2022
9144d37
fix: Flake8 Lintに引っかからないように
gx1285 Oct 16, 2022
06e93aa
new: ban_member
gx1285 Oct 17, 2022
34b4acf
fix: コードミスを修正
gx1285 Oct 17, 2022
3e0c998
fix: F821を修正
gx1285 Oct 17, 2022
712e6ca
fix: Flake8 Lint
gx1285 Oct 17, 2022
974ede8
Merge branch 'EightBot-Developer:main' into main
gx1285 Oct 17, 2022
0dad2f8
new: bot_invite
gx1285 Oct 22, 2022
e914a54
change: 文字を変えた
gx1285 Oct 22, 2022
2d854a4
fix: Flake8 Lintに引っかからないようにした(不完全)
gx1285 Oct 22, 2022
4684b80
fix: Flake8 Lintに引っかからないようにした
gx1285 Oct 22, 2022
9129490
Merge branch 'EightBot-Developer:main' into main
gx1285 Oct 22, 2022
42d0002
new: role_list
gx1285 Oct 22, 2022
4d7f791
fix: class名を変更
gx1285 Oct 22, 2022
b89e9f2
new: voicetext
gx1285 Oct 22, 2022
a240b27
new: 処理を追加
gx1285 Oct 22, 2022
3b60bb8
fix: Flask8 Lint
gx1285 Oct 22, 2022
92b51f9
fix: importし忘れ
gx1285 Oct 22, 2022
42cd881
いろいろ
gx1285 Oct 22, 2022
f2f7b33
fix
gx1285 Oct 22, 2022
1c7fa9e
fix
gx1285 Oct 22, 2022
8b4e2cc
new
gx1285 Oct 22, 2022
1ebf903
change
gx1285 Oct 26, 2022
ca8c63b
tryを消した
gx1285 Oct 27, 2022
ee75ec2
change: Intentsを変えた
gx1285 Oct 28, 2022
e7386e0
fix: message_contentはjishakuで使うのを忘れていた
gx1285 Oct 28, 2022
01dc47e
delete: message_content
gx1285 Oct 28, 2022
5afbf81
new: 未完成機能role_all
gx1285 Oct 29, 2022
b293948
fix: remove
gx1285 Oct 29, 2022
61a1edd
change: ctx => i
gx1285 Oct 29, 2022
38745db
追加などをした
gx1285 Oct 29, 2022
45be88a
lang
gx1285 Oct 29, 2022
9bc5275
new: trans
gx1285 Oct 29, 2022
0fefea1
fix description
gx1285 Oct 29, 2022
9c6a560
fix
gx1285 Oct 29, 2022
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
48 changes: 48 additions & 0 deletions cogs/afk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from discord.ext import commands
from discord import app_commands
from replit import db
import discord


def afk_set_db(key, data):
db[f"afk_{key}"] = data


def afk_get(key):
return db[f"afk_{key}"]


class afk(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot: commands.Bot = bot

@app_commands.describe(reason="afkになる理由")
@app_commands.command(name="afk_set", description="afkをセット又は解除します。")
async def afks(self, i: discord.Interaction, reason: str):
try:
afk_set_db(int(i.user.id), reason)
await i.response.send_message("afkをセットしました!")
except:
await i.response.send_message("afkをセットできませんでした。", ephemeral=True)

@app_commands.command(name="afk_kaizyo", description="afkを解除します")
async def afkk(self, i: discord.Interaction):
try:
afk_set_db(int(i.user.id), False)
await i.response.send_message("afkを解除しました!")
except:
await i.response.send_message("afkを解除できませんでした。", ephemeral=True)

@commands.Cog.listener(name='on_message')
async def afk_msg(self, message: discord.Message):
try:
if message.mentions:
for d in message.mentions:
if afk_get[int(d.id)]:
await message.channel.send("このユーザーはafkです。(こののメッセージは10秒後に削除されます。)", delete_after=10)
except:
pass


async def setup(bot: commands.Bot) -> None:
await bot.add_cog(afk(bot))
29 changes: 29 additions & 0 deletions cogs/ban_member.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from discord.ext import commands
from discord import app_commands
import discord


class ban_member(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot: commands.Bot = bot

@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 def setup(bot: commands.Bot) -> None:
await bot.add_cog(ban_member(bot))
75 changes: 75 additions & 0 deletions cogs/bot_invite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
from discord.ext import commands
from discord import app_commands
import discord
from replit import db


def db_set(key, data):
db[f"bot_invite_db_id_{key}"] = data


def db_get(key):
return db[f"bot_invite_db_id_{key}"]


class MyView(discord.ui.View):
@discord.ui.select(
placeholder="招待するBotの権限を選択して下さい",
min_values=1,
max_values=1,
options=[
discord.SelectOption(
label="管理者",
description="全ての権限を有効にしたURLを生成します。",
value="admin",
),
discord.SelectOption(
label="権限選択式",
description="全ての権限を選択式にしたURLを生成します。",
value="all"
),
discord.SelectOption(
label="権限なし",
description="全ての権限をなしにしたURLを生成します。",
value="none"
),

]
)
async def select_callback(self, select, i):
bot_id = db_get(i.message.id)
d = select.values[0]
if d == "admin":
await i.response.edit_message(f"セレクトメニューをクリックして選択してください\n[Botを招待]({discord.utils.oauth_url(int(bot_id), permissions=discord.Permissions(permissions=discord.Permissions.administrator.flag))})")
elif d == "all":
await i.response.edit_message(f"セレクトメニューをクリックして選択してください\n[Botを招待]({discord.utils.oauth_url(int(bot_id), permissions=discord.Permissions(permissions=discord.Permissions.all()))})")
elif d == "none":
await i.response.edit_message(f"セレクトメニューをクリックして選択してください\n[Botを招待]({discord.utils.oauth_url(int(bot_id))})")
else:
await i.response.edit_message("セレクトメニューをクリックして選択してください\n不明なパラメーターが選択されました。")


class bot_invite(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot: commands.Bot = bot

@app_commands.describe(bot="招待するBot")
@app_commands.command(name="bot_invite", description="Botの招待リンクを生成します。")
async def botinvite(self, i: discord.Interaction, bot: discord.User = None):
if bot:
if bot.bot:
await i.response.send_message("セレクトメニューをクリックして選択してください")
msg = await self.bot.get_channel(i.channel.id).send(view=MyView())
db_set(int(msg.id), int(bot.id))
self.bot.add_view(MyView(), message_id=msg.id)
else:
await i.response.send_message("指定したものはBotではありません。")
else:
await i.response.send_message("セレクトメニューをクリックして選択してください")
msg = await self.bot.get_channel(i.channel.id).send(view=MyView())
db_set(int(msg.id), int(self.bot.id))
self.bot.add_view(MyView(), message_id=msg.id)


async def setup(bot: commands.Bot) -> None:
await bot.add_cog(bot_invite(bot))
2 changes: 1 addition & 1 deletion cogs/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from discord.ext import commands
import Paginator
from discord import app_commands
a = "Tips: `/help コマンド名`か、`eg!help コマンド名`でコマンドを検索できます。"
a = "Tips: `/help コマンド名`でコマンドを検索できます。"


class Help(commands.Cog):
Expand Down
16 changes: 16 additions & 0 deletions cogs/ping.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from discord.ext import commands
from discord import app_commands
import discord


class ping(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot: commands.Bot = bot

@app_commands.command(name="ping", description="ping値を測定します。")
async def pingpong(self, i: discord.Interaction):
await i.response.send_message(f'{round(self.bot.latency * 1000)}ms')


async def setup(bot: commands.Bot) -> None:
await bot.add_cog(ping(bot))
48 changes: 48 additions & 0 deletions cogs/role_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from discord.ext import commands
from discord import app_commands
import discord
import enum


class bot(enum.Enum):
はい = True
いいえ = False


class roleall(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot: commands.Bot = bot

@app_commands.describe(bot='Botにもロールを付与する?')
@app_commands.choices(bot=[
app_commands.Choice(name='はい', value=True),
app_commands.Choice(name='いいえ', value=False),
])
@app_commands.command(name="role_all_add", description="全メンバーにロールを付与します。")
async def roleall_add(self, i: discord.Interaction, role: discord.Role, bot: bool):
if bot:
for member in i.guild.members:
await member.add_roles(role)
elif not bot:
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.command(name="role_all_remove", description="全員からロールを除去します。")
async def roleall_remove(self, i: discord.Interaction, role: discord.Role, bot: bool):
if bot:
for member in i.guild.members:
await member.remove_roles(role)
elif not bot:
for member in i.guild.members:
if not member.bot:
await member.remove_roles(role)


async def setup(bot: commands.Bot) -> None:
await bot.add_cog(roleall(bot))
22 changes: 22 additions & 0 deletions cogs/role_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from discord.ext import commands
from discord import app_commands
import discord


class role_list(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot: commands.Bot = bot

@app_commands.command(name="role_list", description="ロールのリストを送信します。")
async def rolelists(self, i: discord.Interaction):
guild = i.guild
if len(guild.roles) > 1:
role = '\n'.join([r.mention for r in guild.roles][1:])
embed = discord.Embed(title="ロール一覧", description=f"{role}")
await i.response.send_message(embed=embed)
else:
await i.response.send_message('ロールが見つかりませんでした。')


async def setup(bot: commands.Bot) -> None:
await bot.add_cog(role_list(bot))
42 changes: 42 additions & 0 deletions cogs/trans.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from discord.ext import commands
from discord import app_commands
import discord
import async_google_trans_new


class trans_kinou(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot: commands.Bot = bot

@app_commands.describe(text='翻訳するテキスト', lang="翻訳をする言語")
@app_commands.choices(lang=[
app_commands.Choice(name='アルメニア語', value='hy'),
app_commands.Choice(name='中国語(簡体)', value='zh'),
app_commands.Choice(name='オランダ語', value='nl'),
app_commands.Choice(name='英語', value='en'),
app_commands.Choice(name='エスペラント語', value='eo'),
app_commands.Choice(name='フランス語', value='fr'),
app_commands.Choice(name='グルジア語', value='ka'),
app_commands.Choice(name='ドイツ語', value='de'),
app_commands.Choice(name='ギリシャ語', value='el'),
app_commands.Choice(name='イタリア語', value='it'),
app_commands.Choice(name='日本語', value='ja'),
app_commands.Choice(name='韓国語', value='ko'),
app_commands.Choice(name='クルド語', value='ku'),
app_commands.Choice(name='ペルシャ語', value='fa'),
app_commands.Choice(name='ポーランド語', value='pl'),
app_commands.Choice(name='ポルトガル語(ポルトガル、ブラジル)', value='pt'),
app_commands.Choice(name='ルーマニア語', value='ro'),
app_commands.Choice(name='スペイン語', value='es'),
app_commands.Choice(name='スウェーデン語', value='sv'),
app_commands.Choice(name='トルコ語', value='tr'),
app_commands.Choice(name='ウルドゥー語', value='ur'),
])
@app_commands.command(name="google_trans", description="Google翻訳をします。")
async def trans_cmd(self, i: discord.Interaction, lang: str, text: str):
g = async_google_trans_new.AsyncTranslator()
await i.response.send_message(content=await g.translate(text, lang))


async def setup(bot: commands.Bot) -> None:
await bot.add_cog(trans_kinou(bot))
16 changes: 16 additions & 0 deletions cogs/uptime.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from discord.ext import commands
from discord import app_commands
import discord


class uptime(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot: commands.Bot = bot

@app_commands.command(name="up_time", description="Botの起動時間を送信します。")
async def uptime(self, i: discord.Interaction):
await i.response.send_message(f'<t:{self.bot.kidou}:F>')


async def setup(bot: commands.Bot) -> None:
await bot.add_cog(uptime(bot))
1 change: 1 addition & 0 deletions cogs/userinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Userinfo(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot: commands.Bot = bot

@app_commands.describe(user="ユーザー")
@app_commands.command(name="userinfo", description="指定したユーザーの情報を返します。")
async def userinfo(
self,
Expand Down
11 changes: 11 additions & 0 deletions cogs/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ class verify(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot: commands.Bot = bot

@commands.Cog.listener(name='on_interaction')
async def verify_interaction_callback(self, i: discord.Interaction):
if i.data.get('custom_id') == "verify_type_1":
data = verify_db_get(int(i.message.id))
await i.guild.get_member(i.user.id).add_roles(
i.guild.get_role(int(data["role_id"]))
)
await i.response.send_message("ロールを付与しました。", ephemeral=True)
else:
return

@app_commands.describe(name="パネルの名前", description="パネルの説明", role="付与するロール")
@app_commands.command(
name="verify",
Expand Down
31 changes: 0 additions & 31 deletions cogs/verify_callback.py

This file was deleted.

Loading