Skip to content

Conversation

borgrel
Copy link
Contributor

@borgrel borgrel commented Oct 25, 2021

Replace existing functionality

This command is not completed, it still needs a lot of work, this PR is just to replace the current provided features of the old free channel system. Some of the expected improvements will be mentioned in this PR.

Configuration

settings-json

Simply add the channel id's where you want the output and a list of the channels to monitor to the config file. since the json is expected in an array format multiple guilds can easily be added or removed without needing to comb through a list of numbers to find the channels related to one specific guild. Internally the channels are not separated.

There is only allowed to be one status channel per guild, I see no reason why a guild will want to display the status message in multiple places. If a second entry is added to the settings array which points to the same guild no errors will occur and only one channel will end up mapped for that guild.

The bot will throw Illegal state exceptions if the channel id's added to the config do not point to TextChannels.

Status message

status1

The bot will display the status in the designated configured channel.

  • If no message currently exists, it will generate one (and it will thereafter modify the existing one)
  • If the status message is not the last message in the channel, it will delete the old message and display a new one. (This allows moderators to post updates and announcements etc in the channel and the bot will adjust around them)
  • It will search the most recent 10 messages to find an existing status message.

The status message is currently identified by bot is the author and message includes embeds.

The final added check embed has correct title is not currently working. I believe this is because there is no getTitleRaw() method and the only solution I have thought of to date is to store the title constant as 2 strings which is not ideal.

If another command places messages with embeds in the same channel this command will currently modify and or delete them!

Busy Channel

busy message

When a user posts a message in a currently free channel, they get an automated reply. All strings displayed directly to a user are stored in the enum UserStrings so that they are easily modifiable and easily comparable to ensure consistent tone and jargon and language.

This feature needs expansion ...... when a user types in a free channel they will receive a prompt with buttons.
Are you asking a question?

  • Yes -> mark channel as busy.
  • Oops, wrong channel -> delete message.
  • No, just adding additional information to previous question -> If this author is the OP, delete the previous free marker and allow him to continue the previous topic, otherwise move the free channel message below this post.

Free Channel

free message

When the channel is marked as free a message is displayed, for everybody to see. This message is easily modifiable in the UserStrings class.

If a person tries to call the free command in a channel not currently being monitored they receive an ephemeral message stating such.

This feature needs expansion, when a helper tries to mark the channel as free the OP will receive a message with buttons asking if he is satisfied / finished before channel is marked as free. (This will require a timeout on the message as well as not triggering if the OP uses the /free command.

Inactivity

There is currently no scheduled process to check channels on a regular schedule and automatically mark them as available.

Since this is a feature expansion and not a replacement it is not included in this PR. However the bot uses this exact functionality on initialisation to generate the starting status of the channels, so once the bot receives Routine support (#235) it will be a simple method call to add that functionality.

Checklist

  • adjust User messages (in UserStrings) (optional)
  • update config.json
  • run /reload command
  • check that a status message appears in the designated channel
  • check that the status message mentions all channels it must monitor
  • check that typing in a monitored channel that is free changes to busy
    (checking one channel should be enough)
  • check that using /free in a busy channel changes it to free
    (checking one channel should be enough)

@Zabuzard Zabuzard added the new command Add a new command or group of commands to the bot label Oct 25, 2021
@Zabuzard Zabuzard added this to the Migrate existing commands milestone Oct 25, 2021
@Zabuzard Zabuzard linked an issue Oct 25, 2021 that may be closed by this pull request
@Zabuzard Zabuzard changed the title Feature/free channel migration Migrate free channel command Oct 25, 2021
@java-coding-prodigy
Copy link
Contributor

This will work similar to the current free channel system right?

@borgrel
Copy link
Contributor Author

borgrel commented Oct 25, 2021

This will work similar to the current free channel system right?

no, this will not work by typing in ?tag free the free is triggered via a slash command so only /free works
and it will have a lot of improvements over the current system

@borgrel borgrel marked this pull request as ready for review November 5, 2021 08:51
@borgrel borgrel requested review from a team as code owners November 5, 2021 08:51
@CLAassistant
Copy link

CLAassistant commented Nov 15, 2021

CLA assistant check
All committers have signed the CLA.

@Zabuzard Zabuzard mentioned this pull request Nov 16, 2021
13 tasks
@borgrel borgrel requested review from Tais993 and Zabuzard November 17, 2021 21:31
Added Util for ephemeral error messages
Modified Config to load FreeChannel config
Improved Javadocs
Added test Status message
Rebased onto development
Added Util for ephemeral error messages
Modified Config to load FreeChannel config
Improved Javadocs
Added test Status message
Rebased onto development
Cleaned code
Added status message editing
Added on boot channel inactive check
@borgrel borgrel force-pushed the feature/free-channel-migration branch from 7f24892 to e49d8d4 Compare November 23, 2021 14:58
@borgrel
Copy link
Contributor Author

borgrel commented Nov 23, 2021

ready to merge

spotless is failing because of gradle deprecation

@Zabuzard
Copy link
Member

spotless is failing because of gradle deprecation

What? Whats wrong with gradle? Or is your branch behind? Then please rebase.

@borgrel
Copy link
Contributor Author

borgrel commented Nov 30, 2021

spotless is failing because of gradle deprecation

What? Whats wrong with gradle? Or is your branch behind? Then please rebase.

temp

the same thing that fails on all builds atm until gradle 8 is officially released?

i did rebase.

@Zabuzard
Copy link
Member

spotless is failing because of gradle deprecation

What? Whats wrong with gradle? Or is your branch behind? Then please rebase.

temp

the same thing that fails on all builds atm until gradle 8 is officially released?

i did rebase.

Wait what, our current setup fails for all PRs? Why was it merged then, it has to be reverted. Or am I getting something wrong?

We wont merge stuff that fails Spotless.

@Zabuzard
Copy link
Member

@borgrel Spotless fails because your code is wrongly formatted. See here:

Zabuzard
Zabuzard previously approved these changes Nov 30, 2021
@Zabuzard
Copy link
Member

Can you add a release checklist to the PR? I.e. what do we have to do when we merge this? I guess adjust the config, anything else?

@borgrel
Copy link
Contributor Author

borgrel commented Nov 30, 2021

Can you add a release checklist to the PR? I.e. what do we have to do when we merge this? I guess adjust the config, anything else?

done

@borgrel borgrel requested a review from Tais993 November 30, 2021 13:06
@Zabuzard Zabuzard dismissed Tais993’s stale review December 7, 2021 08:23

stale, no response since 7 days.

@Zabuzard
Copy link
Member

Zabuzard commented Dec 7, 2021

7 days without further activity + 1 approving review. Hence, merging.

@Zabuzard Zabuzard merged commit 98d1611 into Together-Java:develop Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new command Add a new command or group of commands to the bot priority: major

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate free channel system

5 participants