11import os
22import discord
3- from discord .commands import Option
3+ from discord .commands import Option , ApplicationContext
44
55bot = discord .Bot (debug_guilds = [...])
66bot .connections = {}
77
88
99@bot .command ()
10- async def start (ctx , encoding : Option (str , choices = ["mp3" , "wav" , "pcm" ])):
10+ async def start (ctx : ApplicationContext , encoding : Option (str , choices = ["mp3" , "wav" , "pcm" , "ogg" , "mka" , "mkv" , "mp4" , "m4a" , ])):
1111 """
1212 Record your voice!
1313 """
@@ -20,8 +20,25 @@ async def start(ctx, encoding: Option(str, choices=["mp3", "wav", "pcm"])):
2020 vc = await voice .channel .connect ()
2121 bot .connections .update ({ctx .guild .id : vc })
2222
23+ if encoding == "mp3" :
24+ sink = discord .sinks .MP4Sink ()
25+ elif encoding == "wav" :
26+ sink = discord .sinks .WaveSink ()
27+ elif encoding == "pcm" :
28+ sink = discord .sinks .PCMSink ()
29+ elif encoding == "ogg" :
30+ sink = discord .sinks .OGGSink ()
31+ elif encoding == "mka" :
32+ sink = discord .sinks .MKASink ()
33+ elif encoding == "mkv" :
34+ sink = discord .sinks .MKVSink ()
35+ elif encoding == "mp4" :
36+ sink = discord .sinks .MP4Sink ()
37+ elif encoding == "m4a" :
38+ sink = discord .sinks .M4ASink ()
39+
2340 vc .start_recording (
24- discord . Sink ( encoding = encoding ) ,
41+ sink ,
2542 finished_callback ,
2643 ctx .channel ,
2744 )
0 commit comments