CS5500-S-2023 / team-bear

team-bear created by GitHub Classroom
0 stars 0 forks source link

Add /createtradingchannel command so the user can create a trading channel with a name they pass in #63

Closed tsanevp closed 1 year ago

tsanevp commented 1 year ago

Intro: We need to implement this command so that if the Guild owner needs to assign a trading channel OR wants to create a new one, they can do so by calling it.

UML: Sequence Diagram UML

Definition of Ready:

Topic | Criteria (What to include in each row) -- | -- User Story | As a buyer on a trading Discord server, I want a way to easily view and buy items within my server so that I don’t have to navigate through multiple channels or chat messages, which will save me time and effort. Dependencies | UserController.java, User.java, JDA, CreateTradingChannel.Java, MessageBuilder.java Plan/Design Process | When a user calls the /createtradingchannel, the user is asked to enter in the new name of the new trading channel. After hitting enter, we check to see if the user is the guild owner. Only the guild owner should be able to define and edit the trading channel. Thus, if they are the owner, continue, else let the user know they are not allowed to use this command.If we continue into the code, the new trading channel is created and set as the trading channel for new listings. We inject MessageBuilder.java to have access to sendPrivateMessage(). We also inject UserController to be able to set the trading channel Id to the guild owner user object. Code | We need to implement the following classes: CreateTradingChannelCommand, we need to add the slashhandler to the command module, and add the event method to the Listener.java class. Acceptance Criteria | This code will be done once all classes and code are implemented and functionality is tested. Since the code/event relies directly on discord functionality, it is not unit testable.

Definition of Done: Comments left on PR but not added here The command to create a new trading channel has been created.

Within the slash command event, three cases may be hit.

The user who called the command does not have the required permissions to create a new trading channel. Thus, they are sent a message denying them from creating the channel.

The given name for the text channel already exists, so the trading channel cannot be created. A message is sent to the user that they must re-call the command and try another name.

The name of the new trading channel does not exist, and the user has proper permissions. Thus the new trading channel is created and assigned as the guild's main trading channel.

This code is not unit testable. Only has discord logic in it really.