Clone this repo at git clone https://github.com/forky01/SOMEHOWDEADBOT.git
npm install
NOTE: discord.js-v13 requires >= Node 16.6
Create a .env
file with the following variables:
-
DISCORD_TOKEN
-
SPOTIFY_CLIENT_ID
-
SPOTIFY_CLIENT_SECRET
How to get each value is explained in Bot and Spotify Setup
Create an application at https://discord.com/developers/applications.
Then add a bot -> in the side nav bar under settings -> Bot: The click the Add Bot
Button
Grab DISCORD_TOKEN value:
- Under settings -> Bot: copy the
TOKEN
and store asDISCORD_TOKEN
in your .env file
To add the bot to a server:
- Under settings -> OAuth2 tab -> URL generator: select the following scopes
bot
,application.commands
and any relevant bot permissions.
Create an app at https://developer.spotify.com/dashboard.
Settings to Modify:
-
Go to Edit settings: add the redirect uri for the auth process (e.g. http://localhost:5000/auth/callback)
-
Note: If
App Status
is indevelopment mode
: Up to 25 Spotify users can install and use your app. These users must be explicitly added under the section "Users and Access" before they can authenticate with your app.
Grab SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET values:
- Under the app name and description, copy the
Client ID
andClient Secret
and store asSPOTIFY_CLIENT_ID
andSPOTIFY_CLIENT_SECRET
in your .env file
When updating commands run: node deploy-commands.js
Global commands are cached for one hour. New global commands will fan out slowly across all guilds and will only be guaranteed to be updated after an hour. Guild commands update instantly. As such, we recommend you use guild-based commands during development and publish them to global commands when they're ready for public use.
https://developer.spotify.com/documentation/general/guides/authorization/code-flow/
user = {
discordName: {
state: (temp) used in auth process to identify the user when callback occurs
msg: (temp) stores the msg which triggered the auth process
accessToken
tokenType
scope
expiresIn
refreshToken
expiresAt
deviceId
}
}
currentListeners = {
voiceChannelId: {
discordName: [tokenAuth, deviceId]
}
}