yes
This commit is contained in:
parent
f24c83afdc
commit
35813b1ebb
@ -14,9 +14,8 @@ bot = bridge.Bot(intents=intents,command_prefix=".")
|
|||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read("config/config.conf")
|
config.read("config/config.conf")
|
||||||
bot.config = config
|
bot.config = config
|
||||||
bot.db = MongoClient(config["mongodb"]["host"],int(config["mongodb"]["port"]),username=config["mongodb"]["username"],password=config["mongodb"]["password"])['data']
|
bot.db = MongoClient(config["mongodb"]["host"],int(config["mongodb"]["port"]),username=config["mongodb"]["username"],password=config["mongodb"]["password"])["dev"]
|
||||||
bot.version = "2.0.0"
|
bot.version = "2.0.0"
|
||||||
|
|
||||||
bot.load_extension("cogs.counting")
|
bot.load_extension("cogs.counting")
|
||||||
bot.load_extension("cogs.misc")
|
bot.load_extension("cogs.misc")
|
||||||
bot.load_extension("cogs.triggers")
|
bot.load_extension("cogs.triggers")
|
||||||
|
|||||||
@ -9,6 +9,17 @@ class Misc(commands.Cog):
|
|||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
|
print("""
|
||||||
|
_________ _______ ______ ______ _______ _________
|
||||||
|
\__ __/|\ /|( ____ )( __ \ ( ___ \ ( ___ )\__ __/
|
||||||
|
) ( | ) ( || ( )|| ( \ )| ( ) )| ( ) | ) (
|
||||||
|
| | | | | || (____)|| | ) || (__/ / | | | | | |
|
||||||
|
| | | | | || __)| | | || __ ( | | | | | |
|
||||||
|
| | | | | || (\ ( | | ) || ( \ \ | | | | | |
|
||||||
|
| | | (___) || ) \ \__| (__/ )| )___) )| (___) | | |
|
||||||
|
)_( (_______)|/ \__/(______/ |/ \___/ (_______) )_(
|
||||||
|
|
||||||
|
""")
|
||||||
print(f"Logged in as {self.bot.user}\nPycord version {discord.__version__}\nTurdbot version {self.bot.version}\n")
|
print(f"Logged in as {self.bot.user}\nPycord version {discord.__version__}\nTurdbot version {self.bot.version}\n")
|
||||||
for guild in self.bot.guilds:
|
for guild in self.bot.guilds:
|
||||||
st = Config(guild.id,self.bot.db)
|
st = Config(guild.id,self.bot.db)
|
||||||
|
|||||||
@ -12,7 +12,7 @@ class Triggers(commands.Cog):
|
|||||||
st = Config(message.guild.id,self.bot.db)
|
st = Config(message.guild.id,self.bot.db)
|
||||||
if message.author.bot == True and st.read("misc","replytobot") == "false" or st.read("triggers","enabled") == "false" or str(message.channel.id) in st.read("triggers","channelblacklist").split("."):
|
if message.author.bot == True and st.read("misc","replytobot") == "false" or st.read("triggers","enabled") == "false" or str(message.channel.id) in st.read("triggers","channelblacklist").split("."):
|
||||||
return
|
return
|
||||||
dict = st.read("triggers","data")
|
dict = st.read("triggers","triggers")
|
||||||
for k,v in dict.items():
|
for k,v in dict.items():
|
||||||
if v["mode"] == "lax":
|
if v["mode"] == "lax":
|
||||||
if k in message.content:
|
if k in message.content:
|
||||||
|
|||||||
@ -6,6 +6,7 @@ from bin.storage import Config
|
|||||||
class Voice(commands.Cog):
|
class Voice(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
self.queue = wavelink.Queue
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
@ -14,22 +15,10 @@ class Voice(commands.Cog):
|
|||||||
port=self.bot.config["wavelink"]["port"],
|
port=self.bot.config["wavelink"]["port"],
|
||||||
password=self.bot.config["wavelink"]["password"],)
|
password=self.bot.config["wavelink"]["password"],)
|
||||||
|
|
||||||
def qhandler(error=None,self=None, ctx=None, st=None):
|
@commands.Cog.listener()
|
||||||
print("test")
|
async def on_track_end(self, player, track, reason):
|
||||||
queue = (st.read("voice", "queue")).split("/./")
|
if not reason == wavelink.TrackEndReason.STOPPED or self.queue.is_empty:
|
||||||
try:
|
player.play(await self.queue.get())
|
||||||
queue.pop(0)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
st.write("voice", "queue", "/./".join(queue))
|
|
||||||
ffmpeg_options = {
|
|
||||||
'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
|
|
||||||
'options': '-vn'
|
|
||||||
}
|
|
||||||
if len(queue) > 0:
|
|
||||||
ctx.voice_client.play(discord.FFmpegPCMAudio(queue[0]), **ffmpeg_options, after=self.qhandler(self, ctx))
|
|
||||||
ctx.respond(f"Now playing: {queue[0]}")
|
|
||||||
|
|
||||||
@bridge.bridge_command(alises=["j"])
|
@bridge.bridge_command(alises=["j"])
|
||||||
async def join(self, ctx):
|
async def join(self, ctx):
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
@ -42,15 +31,13 @@ class Voice(commands.Cog):
|
|||||||
@bridge.bridge_command(alises=["l"])
|
@bridge.bridge_command(alises=["l"])
|
||||||
async def leave(self, ctx):
|
async def leave(self, ctx):
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
st = Config(ctx.guild.id, self.bot.db)
|
|
||||||
st.write("voice", "queue", "")
|
|
||||||
if ctx.voice_client is None:
|
if ctx.voice_client is None:
|
||||||
await ctx.respond("I am not in a voice channel")
|
await ctx.respond("I am not in a voice channel")
|
||||||
else:
|
else:
|
||||||
await ctx.voice_client.disconnect()
|
await ctx.voice_client.disconnect()
|
||||||
|
|
||||||
@bridge.bridge_command(aliases=["p"])
|
@bridge.bridge_command(aliases=["p"])
|
||||||
async def play(self, ctx, *, link: str):
|
async def play(self, ctx, *, link: str=""):
|
||||||
# await ctx.defer()
|
# await ctx.defer()
|
||||||
# args = video.split(" ")
|
# args = video.split(" ")
|
||||||
# providedchannel = False
|
# providedchannel = False
|
||||||
@ -71,7 +58,7 @@ class Voice(commands.Cog):
|
|||||||
# if providedchannel and ctx.author.guild_permissions.administrator == False:
|
# if providedchannel and ctx.author.guild_permissions.administrator == False:
|
||||||
# await ctx.respond("You do not have permission to specify a channel")
|
# await ctx.respond("You do not have permission to specify a channel")
|
||||||
# return
|
# return
|
||||||
|
track = await wavelink.YouTubeTrack.search(link, return_first=True)
|
||||||
if ctx.author.voice is None and channel == "":
|
if ctx.author.voice is None and channel == "":
|
||||||
await ctx.respond("You are not in a voice channel, to specify a channel use `play <link> -channel <channel>`")
|
await ctx.respond("You are not in a voice channel, to specify a channel use `play <link> -channel <channel>`")
|
||||||
return
|
return
|
||||||
@ -79,46 +66,38 @@ class Voice(commands.Cog):
|
|||||||
if ctx.voice_client is None:
|
if ctx.voice_client is None:
|
||||||
if channel == "":
|
if channel == "":
|
||||||
channel = ctx.author.voice.channel
|
channel = ctx.author.voice.channel
|
||||||
vc = await channel.connect(cls=wavelink.Player)
|
await channel.connect(cls=wavelink.Player)
|
||||||
|
|
||||||
if link == "" and ctx.voice_client.is_paused():
|
if link == "" and ctx.voice_client.is_paused():
|
||||||
ctx.voice_client.resume()
|
await ctx.voice_client.resume()
|
||||||
return
|
return
|
||||||
|
|
||||||
if ctx.voice_client.is_paused():
|
if ctx.voice_client.is_paused():
|
||||||
ctx.voice_client.resume()
|
ctx.voice_client.resume()
|
||||||
await vc.play(await wavelink.YouTubeTrack.search(link,return_first=True))
|
|
||||||
await ctx.respond(f"Now playing: {link}")
|
|
||||||
# ffmpeg_options = {
|
|
||||||
# 'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
|
|
||||||
# 'options': '-vn'
|
|
||||||
# }
|
|
||||||
# if not ctx.voice_client.is_playing():
|
|
||||||
# ctx.voice_client.play(discord.FFmpegPCMAudio(video_url, **ffmpeg_options), after=self.qhandler(self=self, ctx=ctx, st=st))
|
|
||||||
# await ctx.respond(f"Now playing: {video_title}")
|
|
||||||
# else:
|
|
||||||
# print("Added to queue")
|
|
||||||
# queue = st.read("voice", "queue").split("/./")
|
|
||||||
# queue.append(info_dict.get("url",None))
|
|
||||||
# st.write("voice", "queue", "/./".join(queue))
|
|
||||||
# await ctx.respond(f"Added to queue: {video_title}")
|
|
||||||
|
|
||||||
@bridge.bridge_command(aliases=["stop"])
|
if self.queue.is_empty and not ctx.voice_client.is_playing():
|
||||||
|
await ctx.voice_client.play(track)
|
||||||
|
await ctx.respond(f"Now playing: {track.title} by {track.author}\n {track.uri}")
|
||||||
|
|
||||||
|
else:
|
||||||
|
await self.queue.put(item=track)
|
||||||
|
await ctx.respond(f"Added to queue: {track.title} by {track.author}\n {track.uri}")
|
||||||
|
|
||||||
|
@bridge.bridge_command(aliases=["stop","s"])
|
||||||
async def pause(self, ctx):
|
async def pause(self, ctx):
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
if ctx.voice_client is None:
|
if ctx.voice_client is None:
|
||||||
await ctx.respond("I am not in a voice channel")
|
await ctx.respond("I am not in a voice channel")
|
||||||
else:
|
else:
|
||||||
await ctx.voice_client.pause()
|
await ctx.voice_client.pause()
|
||||||
await ctx.respond("Paused")
|
|
||||||
|
|
||||||
@bridge.bridge_command(alias=["next", "n","s"])
|
@bridge.bridge_command(aliases=["next","n","st"])
|
||||||
async def skip(self, ctx):
|
async def skip(self, ctx):
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
if ctx.voice_client is None:
|
if ctx.voice_client is None:
|
||||||
await ctx.respond("I am not in a voice channel")
|
await ctx.respond("I am not in a voice channel")
|
||||||
else:
|
else:
|
||||||
ctx.voice_client.stop()
|
ctx.voice_client.play(await self.queue.get())
|
||||||
await ctx.respond("Skipped")
|
await ctx.respond("Skipped")
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user