goldy-bot / goldy-bot-framework Goto Github PK
View Code? Open in Web Editor NEWThe latest and greatest framework powering the Goldy Bot family.
Home Page: http://goldybot.devgoldy.xyz/
License: GNU General Public License v3.0
The latest and greatest framework powering the Goldy Bot family.
Home Page: http://goldybot.devgoldy.xyz/
License: GNU General Public License v3.0
As the title says. Let's remove this option for commands.
With slash commands becoming more and more popular I don't see why you would ever want to force a command to be prefix only. Even if you had a reason it would cause confusion, it would throw off the consistency of slash commands within goldy bot and consistency is one of our goals.
So from this every command WILL be a slash command no matter what and by default a prefix command too but you can disable the prefix command with the slash_cmd_only
parameter just like usual. It's only the normal_cmd_only
parameter that is disappearing.
I need something that will prevent the code at embed["description"] =
:
embed["description"] = embed["description"].format()
just seems extremely weird. Perhaps we should have a method like .format_description()
on the embed that does exactly what .format()
does but without doing the weird piece of code where you format a description then add that newly formatted description to the embed's description again.
class Goldy(GoldyBot.Extension):
def __init__(self):
super().__init__()
self.goldy_embed = GoldyBot.Embed(
title = "๐ Goldy Bot - Stats",
description = """
***__Version:__*
โข GoldyBot: ``{version}``
โข Nextcore: ``{nc_version}``
โข Python: ``{py_version}``
*__Resources:__*
โข Ping: ``{ping}``
โข OS: ``{os}``
โข CPU: ``{cpu}%``
โข RAM: ``{ram} GB``
โข DISK: ``{disk} MB/s``
*Developed with {heart} By <@332592361307897856>***
""",
colour = Colours.YELLOW,
thumbnail = GoldyBot.EmbedImage(self.goldy.bot_user.avatar_url)
)
@GoldyBot.command(name="goldy", description="๐ Shows you stats about the current Goldy Bot framework instance.")
async def goldy_cmd(self, platter: GoldyBot.GoldPlatter):
embed = self.goldy_embed.copy()
embed["description"] = embed["description"].format(
version = GoldyBot.info.VERSION,
nc_version = nextcore.__version__,
py_version = self.goldy.system.python_version,
ping = (lambda x: "(Not Available)" if x is None else f"{round(x * 1000, 2)}ms")(self.goldy.latency),
os = self.goldy.system.os,
cpu = self.goldy.system.cpu,
ram = self.goldy.system.ram,
disk = self.goldy.system.disk,
heart = "๐ค"
)
await platter.send_message(embeds=[embed], reply=True)
Perms.BOT_DEV
in required_roles only allow that command in bot developer's dms.The only thing I use pygame for is its sound mixer module so I can play the ding sound effect mp3 as other libraries were fussy about playing .mp3 files but now I've come to notice that this was one of my worse discussions with Goldy Bot. It's overkill and unstable as fuck (breaks often). It's now broken my git actions because of an installation error, it's time for pygame to go in Goldy Bot v5.0dev12
.
As the title says but also remove the JavaScript library requirement in pyproject.toml
As the title says. Located over here: https://github.com/Goldy-Bot/Goldy-Bot-V5/blob/dev/buttons-implementation/GoldyBot/goldy/objects/golden_platter.py#L47
Like the title says let's add some examples. We can create an examples folder that will hold the necessary python scripts.
We should also link these examples back to our documentation site using this: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-literalinclude
As the title says, we've had a big rewrite recently (#63) so the docs are now false.
I'm getting some weird tracebacks on the alpha production bot that show the content is empty. We need to ignore those message events. I'll send the traceback here soon.
As the title says, let's rename this back to GoldPlatter, it looks much better and is easier to type lmao.
As the title says, we need to add defer to the framework so we can send a wait request to discord for interactions that will take a while to reply to.
As the title says. I think v5 is getting rate limited when creating slash commands, some optimizations will have to be done here.
Commands now have a new attribute called is_hidden
.
Let's add to the command loader for prefix commands and to not respond to the command at all if the command is hidden and the member has no permission.
Yes, I'm insane. As the title says, I'll be rewriting hundreds of lines from the command system.
Commands will have a complete restructure as I'm not happy with the current state of things.
Ordinary extensions seem to be fine but when you reload a package extension (package module) it tends to only reload init.py and not the other modules under and sometimes it doesn't reload anything; very confusing behaviour, this is the case with mal_cord.
There's currently a bug in dev7's .edit()
database method.
It's happening when find_one returns none here: https://github.com/Goldy-Bot/Goldy-Bot-V5/blob/212f0a1ffe0a532c7bdc060a11b3ace9237a887c/GoldyBot/goldy/database/databases/__init__.py#L30-L31
[DEBUG] (Goldy Bot) - [Database] [goldy_main] Found '{'_id': '1016435541199294484'}' in 'guild_configs.'
[DEBUG] (Goldy Bot) - [SlashCommand] [timestamp] Attempting to phrase invoke data into parameters...
[DEBUG] (Goldy Bot) - [SlashCommand] [timestamp] Attempting to invoke command...
[DEBUG] (Goldy Bot) - [PermissionSystem] This command has no required perms. Your free! ๐[INFO] (Goldy Bot) - [SlashCommand] [timestamp] Command invoked by 'emretech#0'.
[DEBUG] (Goldy Bot) - [SlashCommand] [timestamp] Calling sub command...
[DEBUG] (Goldy Bot) - [SlashCommand] [set_defaults] Attempting to phrase invoke data into parameters...
[DEBUG] (Goldy Bot) - [SlashCommand] [set_defaults] Found arg 'America/Los_Angeles'.
[DEBUG] (Goldy Bot) - [SlashCommand] [set_defaults] Found arg '0'.
[DEBUG] (Goldy Bot) - [SlashCommand] [set_defaults] Got args --> {'timezone': 'America/Los_Angeles', 'date_format': 0}
[DEBUG] (Goldy Bot) - [SlashCommand] [set_defaults] Attempting to invoke command...
[DEBUG] (Goldy Bot) - [PermissionSystem] This command has no required perms. Your free! ๐[INFO] (Goldy Bot) - [SlashCommand] [set_defaults] Command invoked by 'emretech#0'.
[INFO] (Goldy Bot) - [Member] [emretech] [Database Wrapper] Pulling updated member data from database...
[DEBUG] (Goldy Bot) - [Member] [emretech] [Database Wrapper] Finding member's data collections...
[DEBUG] (Goldy Bot) - [Member] [emretech] [Database Wrapper] Found member's global data.
[DEBUG] (Goldy Bot) - [Member] [emretech] [Database Wrapper] Found member's guild data for 'nextcore_orx_Server'.
[INFO] (Goldy Bot) - [Member] [emretech] [Database Wrapper] Pushing data to the database...
[DEBUG] (Goldy Bot) - [Database] [goldy_member_data] '{'_id': '1'}' was not found in 'guild_configs.'
[ERROR] (Goldy Bot) - [SlashCommand] [set_defaults] Error occurred in the command 'set_defaults' executed by 'emretech#0'!
Exception occured in event handler
Traceback (most recent call last):
File "/app/GoldyBot/goldy/commands/slash_command.py", line 77, in invoke
return_value = await super().invoke(
File "/app/GoldyBot/goldy/commands/command.py", line 179, in invoke
return await lambda_func()
File "/app/GoldyBot/internal_extensions/timestamps.py", line 172, in set_defaults
await member_data.push(DatabaseEnums.MEMBER_GLOBAL_DATA, {"timezone": timezone, "datetime_formats": datetime_formats})
File "/app/GoldyBot/goldy/database/wrappers/member.py", line 32, in push
await database.edit(self.member.id, {"_id": doc_id}, data, overwrite = False)
File "/app/GoldyBot/goldy/database/databases/__init__.py", line 31, in edit
new_data = utils.update_dict(document_data, data) # Override the document's data with the new data.
File "/app/GoldyBot/utils/_dict.py", line 7, in update_dict
c = d1.copy()
AttributeError: 'NoneType' object has no attribute 'copy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/nextcore/common/dispatcher.py", line 464, in _run_event_handler
await maybe_coro(callback, *args)
File "/usr/local/lib/python3.10/site-packages/nextcore/common/maybe_coro.py", line 69, in maybe_coro
return await result
File "/app/GoldyBot/goldy/commands/listener.py", line 75, in on_interaction
await command[1].invoke(
File "/app/GoldyBot/goldy/commands/slash_command.py", line 88, in invoke
raise front_end_errors.UnknownError(platter, e, self.logger)
File "/app/GoldyBot/goldy/nextcore_utils/front_end_errors.py", line 162, in __init__
raise error
File "/app/GoldyBot/goldy/commands/slash_command.py", line 85, in invoke
await self.__invoke_sub_command(data, platter)
File "/app/GoldyBot/goldy/commands/slash_command.py", line 150, in __invoke_sub_command
await command.invoke(platter)
File "/app/GoldyBot/goldy/commands/slash_command.py", line 88, in invoke
raise front_end_errors.UnknownError(platter, e, self.logger)
GoldyBot.goldy.nextcore_utils.front_end_errors.UnknownError: Error occurred in the command 'set_defaults' executed by 'emretech#0'!
[DEBUG] (Goldy Bot) - [SlashCommand] [set_defaults] Interaction callback message was sent.
As the title says, remove silver platter from recipes and replace it with the golden platter.
As the title says we need to integrate autocomplete into the framework. I want to be able to use this in the timestamp command so I can suggest the use of shortcut aliases options like today
and now
in the date and time parameters.
This feature will bring a lot of potential to goldy bot extensions.
This is a good example video of how discord.py does it: https://youtu.be/zSzFHxOkCfo
I want command permissions to be editable in the guild config.
As the title says.
As the title says.
Okay so 3 days ago I learnt this now needs some rewriting and reorganising.
From now on extensions will always be loaded, there's no option to unload them from memory. However what you can do is disable them, which will disable every single command in that extension.
We should add a new front end exception to the command loader that raises when the command is disabled, notifying the user.
name:
to docker compose.Links:
As said in the title.
Sorry, I'm too lazy to explain right now.
as the title says
As the title says, I would like to move all Dev only commands like /extensions to a one admin command that can only be used by the bot Dev and registered admins in DMs.
As said in the title.
When raise_on_load_error
is set to false goldy bot is meant to ignore the extension and continue loading other stuff but when the user forgets the load()
function the command in the extension loads but the actual extension doesn't so it leads to this error below:
[DEBUG] (Goldy Bot) - [Token] Searching current working directory for .env file if exists...
[DEBUG] (Goldy Bot) - [Token] Grabbing discord token...
[DEBUG] (Goldy Bot) - [Token] Grabbing database token...
[DEBUG] (Goldy Bot) - [Token] Done
[INFO] (Goldy Bot) - [Database] AsyncIOMotorClient Connected!
[DEBUG] (Goldy Bot) - [JSONConfig] Opening config file at './goldy.json'...
[DEBUG] (Goldy Bot) - [JSONConfig] Phrasing json in config to dict...
[DEBUG] (Goldy Bot) - [JSONConfig] Done!
[DEBUG] (Goldy Bot) - [Goldy] Nextcore shard manager connecting...
[DEBUG] (Goldy Bot) - [Goldy] Application data requested!
[DEBUG] (Goldy Bot) - [Database] [goldy_main] Found '{'_id': '863416692083916820'}' in 'guild_configs.'
[DEBUG] (Goldy Bot) - [Database] [goldy_main] Edited '{'_id': '863416692083916820'}' into '{'_id': '863416692083916820', 'code_name': 'test_server', 'prefix': '!', 'roles': {}, 'channels': {}, 'allowed_extensions': [], 'disallowed_extensions': [], 'hidden_extensions': []}.'
[INFO] (Goldy Bot) - [ExtensionLoader] Found extension folder at 'D:\test_goldybot\extensions'.
[DEBUG] (Goldy Bot) - [ExtensionLoader] Found the module 'test.py' in extensions.
[WARNING] (Goldy Bot) - [ExtensionLoader] Couldn't find extension path at 'D:\test_goldybot\env\Lib\site-packages\GoldyBot\internal_extensions'!
[DEBUG] (Goldy Bot) - [Command] [hello] Command initialized!
[DEBUG] (Goldy Bot) - [ExtensionLoader] Calling the 'load()' function in the extension at D:\test_goldybot\extensions\test.py...
[ERROR] (Goldy Bot) - [ExtensionLoader] We encountered an error while trying to load extension at 'D:\test_goldybot\extensions\test.py'! You most likely forgot the 'load()' function.
ERROR --> module 'D:\test_goldybot\extensions\test' has no attribute 'load'
Traceback (most recent call last):
File "run.py", line 5, in <module>
goldy.start() # Launch goldy bot.
File "D:\test_goldybot\env\lib\site-packages\GoldyBot\goldy\__init__.py", line 96, in start
self.async_loop.run_until_complete(
File "C:\Users\jassi\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "D:\test_goldybot\env\lib\site-packages\GoldyBot\goldy\__init__.py", line 127, in __start_async
await self.setup()
File "D:\test_goldybot\env\lib\site-packages\GoldyBot\goldy\__init__.py", line 158, in setup
await self.command_loader.load()
File "D:\test_goldybot\env\lib\site-packages\GoldyBot\goldy\commands\loader.py", line 38, in load
if command.extension.is_ignored == False:
File "D:\test_goldybot\env\lib\site-packages\GoldyBot\goldy\commands\__init__.py", line 105, in extension
return utils.cache_lookup(self.extension_name, extensions_cache)[1]
TypeError: 'NoneType' object is not subscriptable
Because the extension is not loaded when the command is loaded it cannot find the extension leading to this traceback.
I found a BUG with the new command system.
This happens after trying to run the /goldy
slash command. (it's triggering a prefix command ๐ค)
[DEBUG] (Goldy Bot) - [Database] [goldy_main] Found '{'_id': '863416692083916820'}' in 'guild_configs.'
[DEBUG] (Goldy Bot) - [PrefixCommand] [goldy] Attempting to phrase invoke data into parameters...
Exception occured in event handler
Traceback (most recent call last):
File "/home/goldy/Documents/Projects/Python/.goldy_bot/Goldy-Bot-V5/env/lib/python3.8/site-packages/nextcore/common/dispatcher.py", line 464, in _run_event_handler
await maybe_coro(callback, *args)
File "/home/goldy/Documents/Projects/Python/.goldy_bot/Goldy-Bot-V5/env/lib/python3.8/site-packages/nextcore/common/maybe_coro.py", line 69, in maybe_coro
return await result
File "../GoldyBot/goldy/commands/listener.py", line 68, in on_interaction
await command[1].invoke(
File "../GoldyBot/goldy/commands/prefix_command.py", line 61, in invoke
params = self.__invoke_data_to_params(data)
File "../GoldyBot/goldy/commands/prefix_command.py", line 95, in __invoke_data_to_params
for arg in data["content"].split(" ")[1:]:
KeyError: 'content'
For some reason, it triggers the prefix command instead of the slash command.
Further logs show that the prefix command is being registered with the slash command id. This shouldn't be possible.
[DEBUG] (Goldy Bot) - [CommandLoader] Slash command 'goldy' payload grabbed.
[DEBUG] (Goldy Bot) - [CommandLoader] Command 'goldy' loaded.
[DEBUG] (Goldy Bot) - [PrefixCommand] [goldy] 'goldy' has been registered with id 'goldy'!
[DEBUG] (Goldy Bot) - [CommandLoader] Command 'goldy' loaded.
[DEBUG] (Goldy Bot) - [CommandLoader] Slash command 'timestamp' payload grabbed.
[DEBUG] (Goldy Bot) - [CommandLoader] Command 'timestamp' loaded.
[DEBUG] (Goldy Bot) - [PrefixCommand] [timestamp] 'timestamp' has been registered with id 'timestamp'!
[DEBUG] (Goldy Bot) - [CommandLoader] Command 'timestamp' loaded.
[DEBUG] (Goldy Bot) - [CommandLoader] Slash command 'extensions' payload grabbed.
[DEBUG] (Goldy Bot) - [CommandLoader] Command 'extensions' loaded.
[DEBUG] (Goldy Bot) - [PrefixCommand] [extensions] 'extensions' has been registered with id 'extensions'!
[DEBUG] (Goldy Bot) - [CommandLoader] Command 'extensions' loaded.
[INFO] (Goldy Bot) - [Goldy] Nextcore shards are connected and READY!
[DEBUG] (Goldy Bot) - [SlashCommand] [test] 'test' has been registered with id '1126485978496905296'!
[DEBUG] (Goldy Bot) - [SlashCommand] [setup_tree] 'setup_tree' has been registered with id '1126485978496905297'!
[DEBUG] (Goldy Bot) - [PrefixCommand] [hello] 'hello' has been registered with id '1126485978496905298'!
[DEBUG] (Goldy Bot) - [SlashCommand] [bear] 'bear' has been registered with id '1126485978496905299'!
[DEBUG] (Goldy Bot) - [SlashCommand] [nuke] 'nuke' has been registered with id '1126485979012800532'!
[DEBUG] (Goldy Bot) - [SlashCommand] [game] 'game' has been registered with id '1126485979012800534'!
[DEBUG] (Goldy Bot) - [PrefixCommand] [hi] 'hi' has been registered with id '1126485979012800535'!
[DEBUG] (Goldy Bot) - [PrefixCommand] [test_database] 'test_database' has been registered with id '1126485979012800536'!
[DEBUG] (Goldy Bot) - [PrefixCommand] [test_extension] 'test_extension' has been registered with id '1126485979012800537'!
[DEBUG] (Goldy Bot) - [PrefixCommand] [test_args] 'test_args' has been registered with id '1126485979012800539'!
[DEBUG] (Goldy Bot) - [SlashCommand] [test_mention_striper_role] 'test_mention_striper_role' has been registered with id '1126485979486752889'!
[DEBUG] (Goldy Bot) - [SlashCommand] [test_mention_striper_channel] 'test_mention_striper_channel' has been registered with id '1126485979486752890'!
[DEBUG] (Goldy Bot) - [SlashCommand] [test_mention_striper_user] 'test_mention_striper_user' has been registered with id '1126485979486752891'!
[DEBUG] (Goldy Bot) - [SlashCommand] [test_attachment] 'test_attachment' has been registered with id '1126485979486752892'!
[DEBUG] (Goldy Bot) - [SlashCommand] [test_options] 'test_options' has been registered with id '1126485979486752893'!
[DEBUG] (Goldy Bot) - [PrefixCommand] [test_buttons] 'test_buttons' has been registered with id '1126485979486752894'!
[DEBUG] (Goldy Bot) - [PrefixCommand] [test_channels] 'test_channels' has been registered with id '1126485979486752895'!
[DEBUG] (Goldy Bot) - [PrefixCommand] [test_guilds] 'test_guilds' has been registered with id '1126485979486752896'!
[DEBUG] (Goldy Bot) - [PrefixCommand] [stop] 'stop' has been registered with id '1126485979486752898'!
[DEBUG] (Goldy Bot) - [PrefixCommand] [goldy] 'goldy' has been registered with id '1126286658359263234'!
As the title says, the database wrapper is kinda messy. I think we might not need all of this stuff like creating the documents if they don't exist in the update method. If we are able to remove those things will be 100 times cleaner.
Let's check if we can insert data into a document regardless of whether it exists or not, basically if it doesn't exist create it but I want this to be done from the database class.
As said in the title.
Rename MONGODB_TOKEN
to --> MONGODB_URL
.
TOKEN may cause a misunderstanding.
As the title says, I need to transition to global commands for production. However I want to keep guild bound commands for development purposes for obvious reasons.
So somehow we got to implement two separate modes, production mode and development mode.
My domain has changed so we got to update this to the goldybot.devgoldy.xyz
link.
As the title says, we should add an optional callback parameter to this class to allow people to implement their own version of autocomplete.
The following line will be modified: https://github.com/Goldy-Bot/Goldy-Bot-V5/blob/master/GoldyBot/goldy/nextcore_utils/slash_options/auto_complete.py#L58
Added date_format from the timestamp command as a preference in the member database.
as the title says, I'm crazy tied rn it's fucking 2:31 am
As said in the title.
The reason for this is related to this...
In the future, we might have to add some sort of way to reload the guild config of a guild from the database (or just run setup again on that particular guild if that works well). I can see this being needed if the v5 framework is going to be running public invite-able bots.
Source: https://github.com/Goldy-Bot/Goldy-Bot-V5/blob/master/GoldyBot/goldy/guilds/__init__.py#L21
add these commands if possible
As the title says, add this feature to the docs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.