Skip to content

Decouple all ViBot properties from the bot Client object #745

Description

Current Behaviour

Problems, Frustrations, General Description

Currently, when we want 'global' access variables, we tend to assign them to the bot's Client object. This is bad for several reasons such as if Discord ever change how Client is passed around or freeze it from having non-Discord props/methods attached.

Since it's been agreed on by several staff members, I'd also like to play around with the idea of slowly converting ViBot to TypeScript, having these random properties littered into the type makes it exponentially more annoying and possibly impossible how it's currently implemented as JS.

It's just better style overall to keep these properties contained in their related modules and have them required/imported from them instead of pseudo-global.

Tasks

Things to Do

  • Move bot.commands & loadCommands into a commands.js #746
  • Move bot.afkChecks & bot.afkModules into afkChecks.js
  • Move bot.settings, bot.settingsTimestamp & move initializing logic into a settings.js #752
  • Move bot.adminUsers into settings.json
  • Move bot.storedEmojis, bot.emojiServers & commands/emoji.js's update function into a broader emoji.js outside of commands folder
  • Move bot.devServers into settings.json
  • Remove bot.dbs in favor of getDB from dbSetup.js
  • Confirm if there are any other currently unidentified ViBot properties.
  • For settings.roles and settings.channels, map properties to roles instead of being string ids
    • This is meant to reduce code where the vast majority of the uses of these properties are immediately passed into a guild.channels.cache.get(settings.channels.xyz) etc.
  • Preferably, I'd like to keep 'globally' used properties outside of the commands folder; where possible, do so.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ChangeA modification to something that exists

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions