一个类似于Lavalink的音频提供商的库,名为Andesite

granitep的Python项目详细描述


花岗石

Lavalink类音频提供程序的库,名为Andesite,用于discord.py

支持连接here,这里支持Official Documentation

安装

库位于pypi上,安装时使用pip install granitepy 但是,github上有一个更新版本,可以与git一起安装

pip install git+https://github.com/twitch0001/granitepy

示例

importdiscordfromdiscord.extimportcommandsimportandesite# import the libbot=commands.Bot(command_prefix="!")bot.andesite=andesite.Client(bot)@bot.eventasyncdefon_ready():awaitbot.andesite.start_node("127.0.0.1",5000,rest_uri="http://127.0.0.1:5000/",password=None,# set as None if andesite password in application.conf is null :smh:identifier="hello-there",# identifier is only for internal use.)@bot.command()asyncdefconnect(ctx):player=bot.andesite.get_player(ctx.guild.id)# fetches the playerifnotctx.author.voice:returnawaitctx.send("Must be connected to a voice channel")awaitplayer.connect(ctx.author.voice.channel.id)# connects to the channel the command invoker is inawaitctx.send(f"Connected to {ctx.author.voice.channel.name}!")@bot.command()asyncdefplay(ctx,*,search):player=bot.andesite.get_player(ctx.guild.id)tracks=awaitplayer.node.get_tracks(f"ytsearch: {search}")# returns a list andesite.Track objects ifnottracks:# andesite returned no tracks.returnawaitctx.send("Nothing found.")awaitplayer.play(tracks[0])# plays the first track from the list.bot.run("token")

这个库很大程度上是基于EvieePy制作的Wavelink非常感谢制作了wavelink,如果不是wavelink的话,可能会被一些连接的东西卡住。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在AlertDialog builder标题右侧放置图标   安装weblogic server12时发生java获取错误。1在windows 10上   java无法导入:安卓。支持v7。小装置。Android Studio中的RecyclerView   java Android应用程序等待通知奇怪行为   java如何比较ArrayList中的整数元素?   java Quartz属性不会触发Quartz作业   java轻松地将许多JavaFX属性绑定到UINode   Maven插件管理器导致java错误消息的原因是什么?   JAXB解组错误后java文件被阻止   java如何在spark kafka流中创建消费者组并将消费者分配给消费者组   java Gps lat&long随机显示非常不准确的结果   java使用assest文件夹文件在Android上执行shell命令   java如何在客户端使用javascript提取文本   java扩展描述的distincts之和   java重写默认Spring数据REST配置   java SQL未命名参数语法   二进制搜索任务的java真实解决方案   java在一个多模块多数据源项目中,用什么正确的方式来指示将哪个数据源注入我的DAOs?