mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-15 05:48:35 +00:00
af29b857b1
Intermediate commits (oldest → newest): - Testing transcribe - Additions before wsl purge - Transcribe cog - Tst - fx - fx - Fx - Fix - Testing for transcribe - work - Test - Att2 - Att 3 - saving - ffmpeg - Fsink wsink - fx - msink - tst - Fix - 2 - Events - fx1 - fx2 - fix - 11 - A - TR - Fix - Fix - Revert - fx - fx - Fix - fx - fx - fx - fx - aaa - FX - fx - :S - :) - aaaa - fx - fgf - Fx - aa - Fx - ff - aa - as - zzz - fx - :) - fx - fx - addfs - fa - Test - Fixtime - FX - Fix - aa - FX - test - Fa - fix - test - fix - fx - aaa - fix - fx - Hack na hacku hackiem pogania - Fix fo hack - Fix asyncio sleep - tst - tst - 1 - tst 2 - ii - Thread - asa - Fx - Fix - Fx test - fx - tst - asynv - async - fx - fx - Test - SAy - ass - Bugfix - fx - fx - test - fx - fx - fx - fx - Masha wants to code - tesst - test - Fur ktosia! - Last łan for todej mejbi - test - Fixing debug levels - Clock tests
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
import discord
|
|
from discord.ext import commands, voice_recv
|
|
|
|
discord.opus._load_default()
|
|
|
|
bot = commands.Bot(command_prefix=commands.when_mentioned, intents=discord.Intents.all())
|
|
|
|
class Testing(commands.Cog):
|
|
def __init__(self, bot):
|
|
self.bot = bot
|
|
|
|
@commands.command()
|
|
async def test(self, ctx):
|
|
def callback(user, data: voice_recv.VoiceData):
|
|
print(f"Got packet from {user}")
|
|
|
|
## voice power level, how loud the user is speaking
|
|
# ext_data = packet.extension_data.get(voice_recv.ExtensionID.audio_power)
|
|
# value = int.from_bytes(ext_data, 'big')
|
|
# power = 127-(value & 127)
|
|
# print('#' * int(power * (79/128)))
|
|
## instead of 79 you can use shutil.get_terminal_size().columns-1
|
|
|
|
vc = await ctx.author.voice.channel.connect(cls=voice_recv.VoiceRecvClient)
|
|
vc.listen(voice_recv.BasicSink(callback))
|
|
|
|
@commands.command()
|
|
async def stop(self, ctx):
|
|
await ctx.voice_client.disconnect()
|
|
|
|
@commands.command()
|
|
async def die(self, ctx):
|
|
ctx.voice_client.stop()
|
|
await ctx.bot.close()
|
|
|
|
@bot.event
|
|
async def on_ready():
|
|
print('Logged in as {0.id}/{0}'.format(bot.user))
|
|
print('------')
|
|
await bot.add_cog(Testing(bot))
|
|
|
|
REMOTE_HOST_NAME = "discord"
|
|
|
|
|
|
bot.run("NzUxNDQxODgzNDA2MDA4NDEw.Go--wb.Nr28Oo4eYAP1p2XFVHF5uIQfcPD7s_jO2NfMCQ")
|