Initial
This commit is contained in:
commit
7b11736164
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
10
.idea/SquogBot.iml
generated
Normal file
10
.idea/SquogBot.iml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.13 (SquogBot)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.13 (SquogBot)" />
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/SquogBot.iml" filepath="$PROJECT_DIR$/.idea/SquogBot.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
BIN
LittleJayneyCakes_「Cover」Again ( Crusher-P )【Jayn】.mp3
Normal file
BIN
LittleJayneyCakes_「Cover」Again ( Crusher-P )【Jayn】.mp3
Normal file
Binary file not shown.
BIN
MRK_Dadbattle [MRK mix].mp3
Normal file
BIN
MRK_Dadbattle [MRK mix].mp3
Normal file
Binary file not shown.
Binary file not shown.
BIN
RandoHorn_Chase V2 [Encounter Vita Carnis Mix].mp3
Normal file
BIN
RandoHorn_Chase V2 [Encounter Vita Carnis Mix].mp3
Normal file
Binary file not shown.
Binary file not shown.
0
disnake.log
Normal file
0
disnake.log
Normal file
164
main.py
Normal file
164
main.py
Normal file
@ -0,0 +1,164 @@
|
||||
import os
|
||||
import logging
|
||||
import nextcord
|
||||
import yt_dlp
|
||||
import subprocess
|
||||
from nextcord.ext import commands
|
||||
import logging
|
||||
import multiprocessing
|
||||
|
||||
logger = logging.getLogger('disnake')
|
||||
logger.setLevel(logging.DEBUG)
|
||||
handler = logging.FileHandler(filename='disnake.log', encoding='utf-8', mode='w')
|
||||
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
|
||||
logger.addHandler(handler)
|
||||
|
||||
|
||||
SquogServer = 1356433463854497944
|
||||
SquogToken = "MTM1NjU2MTY2MjQyOTM2ODQxMQ.G8aypc.CZBX-x6e4Oad3U5zO0nUgc02d9FDIDSNFybysI"
|
||||
|
||||
SquogHelp = commands.HelpCommand() #command_attrs={"name", "help", "usage", "description"}
|
||||
|
||||
client = commands.Bot(command_prefix="!", intents=nextcord.Intents.all(), help_command = SquogHelp)
|
||||
|
||||
SquogMod = None
|
||||
|
||||
SquogFinalName: str = None
|
||||
def SquogFilename(d):
|
||||
global SquogFinalName
|
||||
SquogFinalName = d.get('info_dict').get('_filename')
|
||||
|
||||
SquogVideo = {
|
||||
"verbose":True,
|
||||
"progress_hooks": [SquogFilename],
|
||||
'final_ext': 'mp3',
|
||||
'postprocessors': [{
|
||||
'key': 'FFmpegExtractAudio',
|
||||
'preferredcodec': 'mp3',
|
||||
}],
|
||||
"outtmpl": './%(uploader)s_%(title)s.%(ext)s',
|
||||
"quality": "low"
|
||||
}
|
||||
|
||||
SquogCurrentConnection: nextcord.VoiceClient = None
|
||||
|
||||
SquogDownload = yt_dlp.YoutubeDL(SquogVideo)
|
||||
|
||||
# _____ _
|
||||
# / ____| | |
|
||||
# | | ___ _ __ ___ _ __ ___ __ _ _ __ __| |___
|
||||
# | | / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` / __|
|
||||
# | |___| (_) | | | | | | | | | | | (_| | | | | (_| \__ \
|
||||
# \_____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|___/
|
||||
|
||||
@client.command(description="Check how fast the bot will reply to you.", help="evil")
|
||||
async def ping(ctx: nextcord.Message):
|
||||
await ctx.reply("Pong!")
|
||||
|
||||
@client.command(description="Join the voice channel.")
|
||||
async def join(ctx: nextcord.Message):
|
||||
print("Joining")
|
||||
print(client.voice_clients)
|
||||
if client.voice_clients.__len__() == 0:
|
||||
if ctx.author.voice:
|
||||
global SquogCurrentConnection
|
||||
SquogCurrentConnection = await ctx.author.voice.channel.connect()
|
||||
await ctx.reply("Joined.")
|
||||
else:
|
||||
await ctx.reply("Can't join as you aren't in any voice channel.")
|
||||
else:
|
||||
await ctx.reply("Can't join as i'm already in a voice channel.")
|
||||
|
||||
@client.command(description="Leaves the voice channel.")
|
||||
async def leave(ctx: nextcord.Message):
|
||||
print("Leaving")
|
||||
if client.voice_clients.__len__() != 0:
|
||||
await client.voice_clients[0].disconnect(force=True)
|
||||
await ctx.reply("Left.")
|
||||
else:
|
||||
await ctx.reply("Can't leave as i'm not in any voice channel.")
|
||||
|
||||
@client.command(description="Plays music in the voice channel.", usage={"link"})
|
||||
async def play(ctx: nextcord.Message, link):
|
||||
global SquogEvilFilename
|
||||
global SquogFinalName
|
||||
SquogEvilFilename = None
|
||||
if client.voice_clients.__len__() == 0:
|
||||
return await ctx.reply("I'm not in a voice channel.")
|
||||
if client.voice_clients[0].is_playing():
|
||||
return await ctx.reply("I'm already playing music.")
|
||||
print(ctx.guild.voice_client.is_connected())
|
||||
print(SquogCurrentConnection)
|
||||
SquogVoiceClient = ctx.guild.voice_client
|
||||
print(link)
|
||||
SquogDownload.download(link)
|
||||
SquogInfo = SquogDownload.extract_info(link, download=False)
|
||||
SquogFinalName = SquogDownload.prepare_filename(SquogInfo)
|
||||
SquogLength = SquogFinalName.__len__() - 4
|
||||
SquogExt = os.path.splitext(SquogFinalName)
|
||||
print(SquogExt)
|
||||
SquogLength = SquogFinalName.find(SquogExt[1]) + 1
|
||||
print(SquogLength)
|
||||
SquogEvilFilename = f"{SquogFinalName[:SquogLength]}mp3"
|
||||
SquogVoiceClient.play(nextcord.FFmpegPCMAudio(f"{SquogEvilFilename}"))
|
||||
|
||||
@client.command(description="Stops the music in voice channel")
|
||||
async def stop(ctx: nextcord.Message):
|
||||
if client.voice_clients.__len__() == 0:
|
||||
return await ctx.reply("I'm not in a voice channel.")
|
||||
if not SquogCurrentConnection.is_playing():
|
||||
return await ctx.reply("I'm not playing music.")
|
||||
SquogCurrentConnection.stop()
|
||||
|
||||
# ______ _
|
||||
# | ____| | |
|
||||
# | |____ _____ _ __ | |_ ___
|
||||
# | __\ \ / / _ | '_ \| __/ __|
|
||||
# | |___\ V | __| | | | |_\__ \
|
||||
# |______\_/ \___|_| |_|\__|___/
|
||||
|
||||
@client.event
|
||||
async def on_member_join(member: nextcord.Member):
|
||||
print(f"Member {member.display_name} joined")
|
||||
await member.add_roles(nextcord.utils.get(member.guild.roles, name="Squog"))
|
||||
|
||||
@client.event
|
||||
async def on_member_remove(member: nextcord.Member):
|
||||
print(f"Member {member.display_name} left")
|
||||
|
||||
@client.event
|
||||
async def on_message_delete(msg: nextcord.Message):
|
||||
embed = nextcord.Embed(
|
||||
title = "Message delete",
|
||||
description = msg.content
|
||||
)
|
||||
embed.set_author(name = msg.author.name)
|
||||
for image in msg.attachments:
|
||||
embed.set_image(image.url) # Unfortunately i cant add multiple images.
|
||||
await SquogMod.send(embed=embed)
|
||||
|
||||
@client.event
|
||||
async def on_command(ctx: commands.Context):
|
||||
embed = nextcord.Embed(
|
||||
title="Command used",
|
||||
description=ctx.message.content
|
||||
)
|
||||
field = embed.add_field(name="Channel", value = ctx.channel.name)
|
||||
await SquogMod.send(embed=embed)
|
||||
|
||||
@client.event
|
||||
async def on_ready():
|
||||
global SquogMod
|
||||
print("Bot logged")
|
||||
SquogMod = client.get_channel(1356577069068324986)
|
||||
print(SquogMod)
|
||||
|
||||
# ______ _ _
|
||||
# | ____| | | (_)
|
||||
# | |__ __ _____ ___ _ _| |_ _ _ __ __ _
|
||||
# | __| \ \/ / _ \/ __| | | | __| | '_ \ / _` |
|
||||
# | |____ > | __| (__| |_| | |_| | | | | (_| |
|
||||
# |______/_/\_\___|\___|\__,_|\__|_|_| |_|\__, |
|
||||
# __/ |
|
||||
# |___/
|
||||
client.run(SquogToken)
|
Loading…
x
Reference in New Issue
Block a user