Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
9 changes: 5 additions & 4 deletions .development.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ mongodb=
movietrackerapi=
rapidapikey=

webhookSlashLogging="",
webhookPrefixLogging="",
webhookBugLogging="",
webhookSuggestionLogging=""
SPOTIFY_CLIENT_ID=your_client_id_here
SPOTIFY_CLIENT_SECRET=your_client_secret_here
SPOTIFY_REDIRECT_URI=http://localhost:3000/callback

PORT=3000
9 changes: 5 additions & 4 deletions .example.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ mongodb=
movietrackerapi=
rapidapikey=

webhookSlashLogging="",
webhookPrefixLogging="",
webhookBugLogging="",
webhookSuggestionLogging=""
SPOTIFY_CLIENT_ID=your_client_id_here
SPOTIFY_CLIENT_SECRET=your_client_secret_here
SPOTIFY_REDIRECT_URI=http://localhost:3000/callback

PORT=3000
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.13.0
21.7.1
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ With over 100 slash command and over 50 prefix commands, Testify is an open sour
6. Paste your client ID into the `clientid` variable inside the `.env` file.
7. Navigate to your discord server, enable developer mode and right click the dropdown beside the server name.
8. Click `Copy Server ID` and paste it into the `guildid` variable inside the `.env` file.
9. Navigate to the `package.json` file and pay attention to the runnable commands listed under `scripts`.
10. Open the terminal in [Visual Studio Code](https://code.visualstudio.com/download) and install all necessary packages using `npm run setup`. This will install the dependencies and give you a brief install guide
11. Open a new terminal and type `npm run prod` to run the file without using **nodemon** or `npm run prod:nodemon` to run the bot with nodemon.
12. The bot should then turn online, you should be able to see this by the console logs that is setup upon start up
9. Visit the [Spotify web API docs](https://developer.spotify.com/documentation/web-api) and sign in. Once signed in, navigate to dashboard. Once on here, you'll need to create an app. Fill out the steps on the site to create your app. Once created, you'll need to copy your clientid and client secret into the `SPOTIFY_CLIENT_ID` & `SPOTIFY_CLIENT_SECRET` fields in the `.env` file. You can leave the `SPOTIFY_REDIRECT_URI` as it is. Only change this if you're updating the port of the Spotify server.
10. Navigate to the `package.json` file and pay attention to the runnable commands listed under `scripts`.
11. Open the terminal in [Visual Studio Code](https://code.visualstudio.com/download) and install all necessary packages using `npm run setup`. This will install the dependencies and give you a brief install guide
12. Open a new terminal and type `npm run prod` to run the file without using **nodemon** or `npm run prod:nodemon` to run the bot with nodemon.
13. The bot should then turn online, you should be able to see this by the console logs that is setup upon start up

- **Runnable commands (scripts)**

Expand All @@ -128,6 +129,9 @@ With over 100 slash command and over 50 prefix commands, Testify is an open sour
**setup-env:dev** - <br>
To run the setup of the `.env.development` file you can run the command `npm run setup-env:dev`, this generates a script in the console that generates a `.env.development` file and where you fill out the fields with whats required for the `.env.development` file and it writes it in the file.

**log-setup** - <br>
To run the setup of the colored logs in the `discord-logs` module. This saves you from manually doing the below method [Setting-up-audit-logs](#setting-up-audit-logs)

## Setting-up-audit-logs

To set the advanced logs registry for the Testify audit-logs ( the event handler registers ) than follow this!
Expand Down
20 changes: 0 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@distube/ytdl-core": "4.14.4",
"@distube/ytsr": "2.0.4",
"@napi-rs/canvas": "^0.1.52",
"@napi-rs/canvas-darwin-arm64": "0.1.66",
"apexify.js": "4.5.43",
"ascii-table": "^0.0.9",
"axios": "^1.6.8",
Expand Down
53 changes: 53 additions & 0 deletions src/api/spotifyTrackerApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const axios = require('axios');

async function getTopItems(accessToken, type, timeRange = 'long_term') {
try {
if (type === 'albums') {
const tracksResponse = await axios.get('https://api.spotify.com/v1/me/top/tracks', {
headers: {
'Authorization': `Bearer ${accessToken}`
},
params: {
limit: 50,
time_range: timeRange
}
});

const albumMap = new Map();
tracksResponse.data.items.forEach(track => {
const album = track.album;
if (album && album.total_tracks > 3) {
const count = albumMap.get(album.id)?.count || 0;
albumMap.set(album.id, {
id: album.id,
name: album.name,
artists: album.artists,
images: album.images,
release_date: album.release_date,
count: count + 1
});
}
});

const topAlbums = Array.from(albumMap.values())
.sort((a, b) => b.count - a.count)
.slice(0, 10);

return topAlbums;
}

const response = await axios.get(`https://api.spotify.com/v1/me/top/${type}`, {
headers: {
'Authorization': `Bearer ${accessToken}`
},
params: {
limit: 10,
time_range: timeRange
}
});

return response.data.items;
} catch (error) {}
}

module.exports = { getTopItems };
52 changes: 0 additions & 52 deletions src/commands/Community/spotify.js

This file was deleted.

54 changes: 0 additions & 54 deletions src/commands/HardModeration/userSchemaClear.js

This file was deleted.

Loading