1
1
import os
2
2
import discord
3
- from discord .commands import Option
3
+ from discord .commands import Option , ApplicationContext
4
4
5
5
bot = discord .Bot (debug_guilds = [...])
6
6
bot .connections = {}
7
7
8
8
9
9
@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" , ])):
11
11
"""
12
12
Record your voice!
13
13
"""
@@ -20,8 +20,25 @@ async def start(ctx, encoding: Option(str, choices=["mp3", "wav", "pcm"])):
20
20
vc = await voice .channel .connect ()
21
21
bot .connections .update ({ctx .guild .id : vc })
22
22
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
+
23
40
vc .start_recording (
24
- discord . Sink ( encoding = encoding ) ,
41
+ sink ,
25
42
finished_callback ,
26
43
ctx .channel ,
27
44
)
0 commit comments