Skip to content

Instantly share code, notes, and snippets.

@binaryoverload
Last active January 22, 2018 07:52
Show Gist options
  • Save binaryoverload/2413faaa1e25a87391d2969e225f8620 to your computer and use it in GitHub Desktop.
Save binaryoverload/2413faaa1e25a87391d2969e225f8620 to your computer and use it in GitHub Desktop.
v4.2 Plan

v4.2 - The cleanup updates

The whole idea with this update is to reduce the size of the main FlareBot class and make everything more maintainable

Main focuses

  • Group methods together to make finding methods easier
  • Document all util methods with JavaDoc comments
  • Organise classes to make sure all fields and methods are in correct place
  • Separate all strings out into JSON

New permissions system

Instead of a "Default" group, just check for if the perm is default and execute it. This will work with the negative permissions which I want to add as well, they can just make a group and negative a permission. Benefit of this is we don't need to worry about adding new perms.

Enum to hold all permissions, allows permissions to be listed while still keeping the dynamic nature described. Also allows permissions to be validated.

  • public Permissions(String perm, boolean default) - Default constructor
  • public Permissions String perm, Class<? extends Command> command, boolean default) - Used for linking command specific perms
  • Permissions.<PERMISSION>.hasPermission(Member member, GuildWrapper wrapper) - Checks permission taking into account default and negation perms

FlareBot.java

  • Move config into manager

    • Non static, instance based manager
  • Move all command logic and registering into a new class

    • "CommandManager"?
  • Move util methods to a util class

    • getInvite
    • getVersion
    • getMessage
    • formatTime
    • getDayOfMonthSuffix
  • Make a constants class

    • Methods
      • getOfficialGuild
      • getImportantLogChannel
      • getErrorLogChannel
      • getGuildLogChannel
      • getEGLogChannel
    • Constants
      • INVITE_URL
      • COMMAND_CHAR
      • OFFICIAL_GUILD
      • FLAREBOT_API
      • DEVELOPER_ID
      • CONTRIBUTOR_ID
      • STAFF_ID
      • FLARE_TEST_BOT_CHANNEL
  • Reorganise FlareBot.java to have all fields at the top

  • Move "getters" to a separate class

    • getVoiceChannels
    • getActiveVoiceChannels
    • getChannelByID
    • getGuildByID
    • getGuilds
    • getChannels
    • getConnectedVoiceChannels
    • getUsers
    • getUserByID
    • retrieveUserByID

Events.java

  • Group events based on type of thing they are acting on (Guild, Message, Member, etc..)

  • Add javadoc comments to all methods detailing what they are used for and what class they are linked to if any. This doesn't have to be a full JavaDoc comment, it just needs to describe the function of the method.

  • Rename "handle" methods to something more appropriate

    • Avoid using handler methods where appropriate
  • Group all getters

ConfirmUtil.java

  • Comment methods (JavaDoc)
  • Make time needed to confirm flexible?
    • Either change expirymap logic to allow purge(boolean force, long time)
    • Or make a map of expiry maps, could get very messy

GeneralUtils.java

  • Group by type of util (Messages, Parsers, Converters, etc...)
  • Comment methods (JavaDoc)

Prepare for modular FlareBot

  • Move stuff like this
  • Move prefixes into GuildWrapper

Git Handling

  • Make a class to handle git (versions and commit hash etc)
  • Set sentry release to commit hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment