teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

成功例を追加しました。

2020/08/20 12:47

投稿

KeilyX07
KeilyX07

スコア29

title CHANGED
File without changes
body CHANGED
@@ -31,4 +31,17 @@
31
31
  Windows 10 x64
32
32
  discord.py 1.4.1
33
33
  ffmpeg 1.4
34
- python 3.8.3
34
+ python 3.8.3
35
+
36
+ ## 【追記】成功例
37
+ ```Python
38
+ @bot.command(pass_context=True)
39
+ async def alarm(ctx):
40
+ role = ctx.guild.get_role(#roleidを貼っています)
41
+ if ctx.author.guild_permissions.administrator or role in ctx.author.roles:
42
+ channel = ctx.message.author.voice.channel
43
+ voice = get(client.voice_clients, guild=ctx.guild)
44
+ player = voice.play(discord.FFmpegPCMAudio('other/alarm.mp3'))
45
+ else:
46
+ await ctx.send('権限がありません')
47
+ ```