-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
2,079 additions
and
2,079 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": true | ||
"useTabs": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
# README | ||
|
||
1. Install NodeJS and NPM | ||
2. Clone the repo (<https://github.com/humanat/takBot>) | ||
3. Run `npm i` | ||
4. Run `git submodule init && git submodule sync && git submodule update` | ||
5. Run `pushd TPS-Ninja && npm i && popd` | ||
6. Run `cp auth.json.template auth.json; cp results.db.template results.db` | ||
7. Make your own application through Discord (<https://discord.com/developers/applications>) | ||
8. Copy the token from the Bot page and paste it in `auth.json` after `token`. | ||
9. Copy the Application ID from the General Information page and paste it in `auth.json` after `clientId`. | ||
1. Install NodeJS and NPM | ||
2. Clone the repo (<https://github.com/humanat/takBot>) | ||
3. Run `npm i` | ||
4. Run `git submodule init && git submodule sync && git submodule update` | ||
5. Run `pushd TPS-Ninja && npm i && popd` | ||
6. Run `cp auth.json.template auth.json; cp results.db.template results.db` | ||
7. Make your own application through Discord (<https://discord.com/developers/applications>) | ||
8. Copy the token from the Bot page and paste it in `auth.json` after `token`. | ||
9. Copy the Application ID from the General Information page and paste it in `auth.json` after `clientId`. | ||
10. Run `node deploy-commands` | ||
11. Run `node bot` (`Ctrl+C` to end) | ||
12. Invite your bot to your own Discord server by generating an invite link from the OAuth2 page of the Discord portal | ||
1. Add redirect URL `https://discordapp.com/oauth2/authorize?&client_id=<ClientID>&scope=bot` with your client ID. | ||
2. Select scopes `bot` and `messages.read` | ||
3. Select the appropriate permissions | ||
4. Press the Copy button in the Scopes section | ||
5. Paste into a new browser tab | ||
1. Add redirect URL `https://discordapp.com/oauth2/authorize?&client_id=<ClientID>&scope=bot` with your client ID. | ||
2. Select scopes `bot` and `messages.read` | ||
3. Select the appropriate permissions | ||
4. Press the Copy button in the Scopes section | ||
5. Paste into a new browser tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"token": "your-token-goes-here", | ||
"clientId": "your-application-id-goes-here" | ||
"token": "your-token-goes-here", | ||
"clientId": "your-application-id-goes-here" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
const { SlashCommandBuilder } = require("discord.js"); | ||
const { | ||
cleanupFiles, | ||
clearInactiveTimer, | ||
deletePtnFile, | ||
getGameData, | ||
getLink, | ||
isGameOngoing, | ||
renameChannel, | ||
sendMessage, | ||
setDeleteTimer, | ||
cleanupFiles, | ||
clearInactiveTimer, | ||
deletePtnFile, | ||
getGameData, | ||
getLink, | ||
isGameOngoing, | ||
renameChannel, | ||
sendMessage, | ||
setDeleteTimer, | ||
} = require("../util"); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName("end") | ||
.setDescription("Cancel the current game."), | ||
async execute(interaction) { | ||
if (!isGameOngoing(interaction)) { | ||
return sendMessage( | ||
interaction, | ||
"There is no ongoing game in this channel.", | ||
true | ||
); | ||
} | ||
data: new SlashCommandBuilder() | ||
.setName("end") | ||
.setDescription("Cancel the current game."), | ||
async execute(interaction) { | ||
if (!isGameOngoing(interaction)) { | ||
return sendMessage( | ||
interaction, | ||
"There is no ongoing game in this channel.", | ||
true | ||
); | ||
} | ||
|
||
const gameData = getGameData(interaction); | ||
let message = "The game in this channel has been removed."; | ||
if (gameData.hl) { | ||
message += | ||
"\nHere's a link to the unfinished game:\n" + getLink(gameData.gameId); | ||
} | ||
cleanupFiles(interaction.channel.id); | ||
deletePtnFile(gameData); | ||
await sendMessage(interaction, message); | ||
clearInactiveTimer(interaction); | ||
setDeleteTimer(interaction); | ||
return renameChannel(interaction, false); | ||
}, | ||
const gameData = getGameData(interaction); | ||
let message = "The game in this channel has been removed."; | ||
if (gameData.hl) { | ||
message += | ||
"\nHere's a link to the unfinished game:\n" + getLink(gameData.gameId); | ||
} | ||
cleanupFiles(interaction.channel.id); | ||
deletePtnFile(gameData); | ||
await sendMessage(interaction, message); | ||
clearInactiveTimer(interaction); | ||
setDeleteTimer(interaction); | ||
return renameChannel(interaction, false); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.