質問編集履歴

1

成功例を追加しました。

2020/08/20 12:47

投稿

KeilyX07
KeilyX07

スコア29

test CHANGED
File without changes
test CHANGED
@@ -65,3 +65,29 @@
65
65
  ffmpeg 1.4
66
66
 
67
67
  python 3.8.3
68
+
69
+
70
+
71
+ ## 【追記】成功例
72
+
73
+ ```Python
74
+
75
+ @bot.command(pass_context=True)
76
+
77
+ async def alarm(ctx):
78
+
79
+ role = ctx.guild.get_role(#roleidを貼っています)
80
+
81
+ if ctx.author.guild_permissions.administrator or role in ctx.author.roles:
82
+
83
+ channel = ctx.message.author.voice.channel
84
+
85
+ voice = get(client.voice_clients, guild=ctx.guild)
86
+
87
+ player = voice.play(discord.FFmpegPCMAudio('other/alarm.mp3'))
88
+
89
+ else:
90
+
91
+ await ctx.send('権限がありません')
92
+
93
+ ```