Programming-Simplified-Community / CommunityBot

GNU General Public License v2.0
1 stars 1 forks source link

Team Name Change #32

Open JBraunsmaJr opened 2 years ago

JBraunsmaJr commented 2 years ago

When user invokes the change-name command they should automatically be casted for yes instead of being forced to vote yes on their own suggestion.

gouthamvelicheti commented 2 years ago

@JBraunsmaJr I can pick this up and while setting up in local, I tried to start the API which is the entry point, and it is causing a couple of below issues, can you please put the dependent services to start and a few more detailed steps to debug in local.

  1. CodeJam.Services.CodeJamBot[0], Error. Bot is disconnecting: System.Exception: WebSocket connection was closed ---> Discord.Net.WebSocketClosedException: The server sent close 4004: "Authentication failed."
  2. JamScheduleService Waiting for bot to reach a healthy state
JBraunsmaJr commented 2 years ago

Ah, fair point I'll add that to setup

You will need to grab a discord token from the discord developer portal. This will be for local testing. https://discord.com/developers/applications

IDK which IDE you're using, but if you CD into your project directory via command line you can set the token via

dotnet user-secrets set "CodeJamBot:Discord:Token" "yourtokenhere"
JBraunsmaJr commented 2 years ago

What this does is stores the token outside of source control thus making it safe to use... prevents accidentally leaking API keys and what not. If you accidently commit it on a public repo Discord auto-revokes that token forcing you to get a new token

gouthamvelicheti commented 2 years ago

Ok got it, Thank you

JBraunsmaJr commented 2 years ago

https://github.com/Programming-Simplified-Community/CommunityBot/blob/main/Docs/TOC.md

Have been adding to our documentation. Just added some notes on database

gouthamvelicheti commented 2 years ago

I created an application in the discord developer portal with a BOT, added admin privileges to the bot, and stored the token to the secrets but still, I am getting "Discord.Net.WebSocketClosedException: The server sent close 4014: "Disallowed intent(s)." Am I missing any other settings while running the API, able to set up the DB

JBraunsmaJr commented 2 years ago

In the portal, for your bot try enabling members intents. Then try again?

gouthamvelicheti commented 2 years ago

Updated and it got connected but getting the below error now.

CodeJam.Services.CodeJamBot[0] Connected fail: CodeJam.Services.CodeJamBot[0] An error occurred while initializing bot: Discord.Net.HttpException: The server responded with error 50001: Missing Access at Discord.Net.Queue.RequestBucket.SendAsync(RestRequest request) at Discord.Net.Queue.RequestQueue.SendAsync(RestRequest request) at Discord.API.DiscordRestApiClient.SendInternalAsync(String method, String endpoint, RestRequest request) at Discord.API.DiscordRestApiClient.SendJsonAsync[TResponse](String method, String endpoint, Object payload, BucketId bucketId, ClientBucketType clientBucket, RequestOptions options) at Discord.API.DiscordRestApiClient.BulkOverwriteGuildApplicationCommandsAsync(UInt64 guildId, CreateApplicationCommandParams[] commands, RequestOptions options) at Discord.Rest.InteractionHelper.BulkOverwriteGuildCommandsAsync(BaseDiscordClient client, UInt64 guildId, ApplicationCommandProperties[] args, RequestOptions options) at Discord.Rest.ClientHelper.BulkOverwriteGuildApplicationCommandAsync(BaseDiscordClient client, UInt64 guildId, ApplicationCommandProperties[] properties, RequestOptions options) at Discord.Interactions.InteractionService.RegisterCommandsToGuildAsync(UInt64 guildId, Boolean deleteMissing) at CodeJam.Services.CodeJamBot.ReadyAsync() in \CodeJamBot.cs:line 246

JBraunsmaJr commented 2 years ago

Ah. Inside appsettings.json the primary guild Id needs to be your test server. Can right click on your server icon from list of servers to select copy ID.

Similarly the channel IDs can be done the same way. Role ID is the ID of role to assign people when they want to join the codejam.

Not the ideal route. Guild ID is fine but channel and role I feel should be dynamically fetched via name, and created if not found. Haven't gotten around to finding the right call for it in the Discord.NET api.