Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
We Are Come Back :D
Browse files Browse the repository at this point in the history
Removed forms
Prefix command is now deprecated
Removed some functions which used for prefix commands
Fixed embed color implementation
Fixed problem related with SettingsCog
Splitted VoiceCog to PrivateRoomsCog and MusicCog
  • Loading branch information
nixxoq committed Dec 29, 2023
1 parent 7f0e07b commit 27ec653
Show file tree
Hide file tree
Showing 17 changed files with 635 additions and 1,069 deletions.
57 changes: 29 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
## The Synth Discord Bot

### **Synth** - is a multi-functional Discord bot with a wide range of features to help you customize your guild. It includes everything from basic utility commands and fun commands to more advanced features.

# TODO:

- [x] Basic Utility commands
- [x] Moderation commands
- [x] Fun commands
- [x] Private Rooms
- [ ] Starboard system (custom setting)
- [ ] Welcome/goodbye messages
- [ ] Music player (spotify && your files)
- [ ] Eval system (without internet connection && unrelated to the bot)
- [ ] Ticket system
- [x] Backup system
- [ ] Economy system (?, incomplete)
- [x] Giveaways
- [ ] Forms system (https://docs.google.com/document/d/1LywTG8IN6ACVAJMPqUHMXY8DrSV-DpPOFIEdCt6OEVk/edit)
- [ ] Logging system (?, incomplete)
- [ ] Youtube/Twitch/Trovo notifications
- [x] Localization for slash commands
- [ ] Localization for context commands
- [ ] Hybrid commands (slash commands && context commands)



## Developers:
#### [LazyDev](https://github.com/devbutlazy)
#### [Weever](https://github.com/prunus1337)
#### [Snaky](https://github.com/Snaky1a)

# TODO:

- [x] Basic Utility commands
- [x] Moderation commands
- [x] Fun commands
- [x] Private Rooms
- [ ] Starboard system (custom setting)
- [ ] Welcome/goodbye messages
- [ ] Music player (spotify && your files)

- [ ] Eval system (without internet connection && unrelated to the bot)
- [ ] Ticket system
- [ ] Backup system
- [ ] Economy system (?, incomplete)
- [x] Giveaways
- [ ] Forms system (https://docs.google.com/document/d/1LywTG8IN6ACVAJMPqUHMXY8DrSV-DpPOFIEdCt6OEVk/edit)
- [ ] Logging system (?, incomplete)
- [ ] Youtube/Twitch/Trovo notifications
- [x] Localization for slash commands
- [ ] Localization for context commands
- [ ] Hybrid commands (slash commands && context commands)



## Developers:
#### [LazyDev](https://github.com/devbutlazy)
#### [Weever](https://github.com/prunus1337)
#### [Snaky](https://github.com/Snaky1a)
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

if __name__ == "__main__":
debug = bool(getenv("DEBUG", False))
token = getenv("DISCORD_TOKEN", "token")
token = "MTE2ODIyNjg5NTc1ODkwMTQwOA.GCNd9-.Qgk_m-7atWUxb73e4LMmB564bUyPP8w0xlmTX4"

bot.Bot(debug=debug).run(token)
76 changes: 18 additions & 58 deletions src/bot.py
Original file line number Diff line number Diff line change
@@ -1,49 +1,44 @@
import logging
import os
import sys
import traceback

import disnake
from disnake.ext import commands

from .utils import misc
from .utils.help import CustomHelpCommand
from .utils.misc import get_prefix, is_command_disabled
from .utils.misc import extension


# from disnake.ext.ipc import Server


class Bot(commands.Bot):
class Bot(commands.InteractionBot):
"""The base class of Synth bot."""

def __init__(self, debug: bool = False) -> None:
super(Bot, self).__init__(
help_command=CustomHelpCommand(),
command_prefix=misc.bot_get_guild_prefix,
# help_command=CustomHelpCommand(),
# command_prefix=misc.bot_get_guild_prefix,
intents=disnake.Intents.all(),
reload=True,
owner_ids={419159175009009675, 999682446675161148, 1167458549132181668},
owner_ids=[419159175009009675, 999682446675161148, 1167458549132181668],
test_guilds=[1109511263509291098],
)

# self.ipc = Server(self, secret_key=config.SECRET_IPC_KEY) # well... need talk about config
self.i18n.load("src/utils/locale")
self.debug = debug

async def on_message(self, message: disnake.Message):
prefix = await get_prefix(message)
prefix_len = len(prefix)
# async def on_message(self, message: disnake.Message):
# prefix = await get_prefix(message)
# prefix_len = len(prefix)

if message.content.startswith(prefix):
# TODO: blacklist
# if message.content.startswith(prefix):
# # TODO: blacklist

# check if command is disabled
command = message.content.split()[0][prefix_len:]
result = await is_command_disabled(message=message, command=command)
if result:
return
# # check if command is disabled
# command = message.content.split()[0][prefix_len:]
# result = await is_command_disabled(message=message, command=command)
# if result:
# return

return await self.process_commands(message=message)
# return await self.process_commands(message=message)

# async def setup_hook(self):
# await self.ipc.start()
Expand All @@ -54,43 +49,8 @@ async def on_ready(self) -> None:
f"{self.user.id}&permissions=980937982&scope=bot%20applications.commands"
)
logging.debug(f"Connected to {self.user}")
for extension in os.listdir("src\\cogs"):
if extension.endswith(".py"):
try:
event_name = extension[:-3]
self.load_extension(f"src.cogs.{event_name}")
except (
commands.ExtensionNotFound,
commands.NoEntryPointError,
commands.ExtensionFailed,
commands.ExtensionError,
) as e:
logging.error(
f"\n\nFailed to load {extension}!\n{traceback.print_exception(e)}"
)
continue
finally:
logging.info(f"{extension} is loaded!")

for event in os.listdir("src\\events"):
if not event.endswith(".py"):
continue

try:
self.load_extension(f"src.events.{event[:-3]}")
except (
commands.ExtensionNotFound,
commands.NoEntryPointError,
commands.ExtensionFailed,
commands.ExtensionError,
) as e:
logging.error(
f"\n\nFailed to load {extension}!\n{traceback.print_exception(e)}"
)
continue
finally:
logging.info(f"{event} event is loaded!")

await extension(self)
await self.wait_until_ready()
await self.change_presence(
activity=disnake.Activity(
Expand Down
15 changes: 8 additions & 7 deletions src/cogs/BackupsCog.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,12 @@ def __init__(self, bot: commands.Bot) -> None:
async def cog_load(self) -> None:
await self.backups.fetch_and_cache_all()

@commands.group(invoke_without_command=True)
@commands.slash_command(name="backup", description="Backup system") # TODO: locale
@commands.has_permissions(administrator=True)
@commands.dynamic_cooldown(custom_cooldown, commands.BucketType.user)
async def backup(self, ctx: commands.Context) -> None:
embed = disnake.Embed(color=self.settings_db.get_embed_color(ctx.guild.id))
async def backup(self, interaction: disnake.MessageCommandInteraction) -> None:
embed = disnake.Embed(
color=self.settings_db.get_embed_color(interaction.guild_id)
)
embed.title = "Backup system"
embed.add_field(
name="Information",
Expand All @@ -252,8 +253,8 @@ async def backup(self, ctx: commands.Context) -> None:
inline=False,
)

if backups.check_backup(ctx.guild):
data = await backups.get(guild_id=ctx.guild.id)
if backups.check_backup(interaction.guild):
data = await backups.get(guild_id=interaction.guild_id)
if data and data.get("backup_data", None):
data = data.get("backup_data", None)
embed.add_field(
Expand All @@ -264,7 +265,7 @@ async def backup(self, ctx: commands.Context) -> None:
embed.set_footer(
text="Synth © 2023 | All Rights Reserved", icon_url=self.bot.user.avatar
)
await ctx.send(embed=embed, view=BackupsView(self.bot))
await interaction.send(embed=embed, view=BackupsView(self.bot), ephemeral=True)


def setup(bot: commands.Bot) -> None:
Expand Down
Loading

0 comments on commit 27ec653

Please sign in to comment.