Skip to content

Commit b02fcc6

Browse files
committed
fix: ステータス
1 parent 1a05bf6 commit b02fcc6

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

cogs/pin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ def __init__(self, bot: commands.Bot):
3535
print("init -> PinCog")
3636

3737
@commands.hybrid_command(name="pin", description="メッセージをピン留めします。")
38+
@commands.has_permissions(pin_messages=True)
3839
async def pin(self, ctx: commands.Context):
3940
if not ctx.interaction.response:
4041
await ctx.reply("`/pin`で実行できます。")
4142
return
4243
await ctx.interaction.response.send_modal(PinModal())
4344

4445
@commands.hybrid_command(name="unpin", description="ピン留めを解除します。")
46+
@commands.has_permissions(pin_messages=True)
4547
async def unpin(self, ctx: commands.Context):
4648
await ctx.defer(ephemeral=True)
4749

main.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from discord.app_commands.tree import CommandTree
2-
from discord.ext import commands
2+
from discord.ext import commands, tasks
33
import discord
44
from discord.ext.commands.bot import _default
55
from discord.utils import MISSING
@@ -38,6 +38,10 @@ async def setup_hook(self):
3838

3939
bot = UniBot()
4040

41+
@tasks.loop(seconds=10)
42+
async def loop_status():
43+
await bot.change_presence(activity=discord.CustomActivity(name="UniPro製Bot"))
44+
4145
@bot.event
4246
async def on_ready():
4347
print("Ready.")

0 commit comments

Comments
 (0)