Coder Social home page Coder Social logo

voice's Introduction

WIP - MAY AND WILL CHANGE IN ANY FORM AND IS NOT GUARANTEED TO WORK IN IT'S CURRENT STATE

voice


Hello! If you came across this library, you probably tried to implement voice functions with interactions.py, but that was not possible, since it natively does not support voice. But don't worry! With voice you can do exactly that! We not only add the VOICE_STATE_UPDATE event but also the ability to connect to voice channels and transmit audio.

This will be a basic guide on how to install and use this library.

Installation


pip install -U interactions-voice

But what exactly is this library and what does it do?


This library is an extension for interactions.py, what gives it the ability to connect to voice and send data and to listen to the voice_state_update event.

Example usage:


from interactions import CommandContext, Channel
from interactions.ext.voice import VoiceState, VoiceClient

bot: VoiceClient = VoiceClient(token="...")

@bot.event
async def on_voice_state_update(vs: VoiceState):
    print(vs.self_mute)
    ...

@bot.command(name="connect", description="...", options=[...])
async def connect(ctx: CommandContext, channel: Channel):
    await bot.connect_vc(channel_id=int(channel.id), guild_id=int(ctx.guild_id), self_deaf=True, self_mute=False)
    await bot.play(file="C:/...")

If you do not want to use the VoiceClient object, you can also use the library this way:

from interactions import Client, CommandContext, Channel
from interactions.ext.voice import setup, VoiceState

bot: Client = Client(token="...")
setup(bot)


@bot.event
async def on_voice_state_update(vs: VoiceState):
    print(vs.self_mute)
    ...

@bot.command(name="connect", description="...", options=[...])
async def connect(ctx: CommandContext, channel: Channel):
    await bot.connect_vc(channel_id=int(channel.id), guild_id=int(ctx.guild_id), self_deaf=True, self_mute=False)
    await bot.play(file="C:/...")

voice's People

Contributors

edvraz avatar arhsm avatar i0bs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.