mirror of
https://github.com/jcreek/denBot.git
synced 2026-07-13 19:03:45 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 482af77249 | |||
| 67566a6fea | |||
| 628c063c15 | |||
| 6cef805649 | |||
| 4133eae25d | |||
| e752d3ce80 | |||
| 400b34b9e4 | |||
| 7bf9ae00ee |
@@ -35,12 +35,24 @@ For a sanity check, you can run `docker images` and it should be displayed in th
|
||||
|
||||
## Running the Docker container
|
||||
|
||||
Running the bot with -d runs the container in detatched mode (as in it runs in the background). If you want to see what is happening, remove that option.
|
||||
Running the bot with --detach runs the container in detatched mode (as in it runs in the background). If you want to see what is happening, remove that option.
|
||||
|
||||
`docker run -d denbot`
|
||||
`docker run --detach --name denbot denbot`
|
||||
|
||||
You can use CTRL+C to exit out of this command window. If you're using Windows, Docker Desktop will now show your bot under 'Containers/Apps', from where you can easily stop and start it using the GUI.
|
||||
|
||||
## Updating
|
||||
|
||||
If doing it manually, in the folder with all the files run:
|
||||
|
||||
```
|
||||
docker stop denbot
|
||||
docker rm denbot
|
||||
docker image rm denbot
|
||||
docker build -t denbot .
|
||||
docker run --detach --name denbot denbot
|
||||
```
|
||||
|
||||
### More information
|
||||
|
||||
If you want more of a sanity check here are some following commands you can run the following commands:
|
||||
@@ -51,3 +63,7 @@ If you want more of a sanity check here are some following commands you can run
|
||||
To access the command line inside the docker container you can run:
|
||||
|
||||
`docker exec -it <container id> /bin/bash`
|
||||
|
||||
## Future feature suggestions
|
||||
|
||||
* If the party want to continue with the same people and the same link code they can do !again (only in the private chat) to run again and get the party for 30 more mins (denBot would also post the link code again so people can see it without scrolling) - using something like https://stackoverflow.com/questions/36563749/how-i-extend-settimeout-on-nodejs and an array of all the queues, removing those and their deletion functions each time an adventure channel is deleted
|
||||
|
||||
@@ -136,9 +136,14 @@ function checkQueue(message) {
|
||||
|
||||
makeTempChannel(message, adventureMessage);
|
||||
|
||||
// Clear the queue
|
||||
// Clear the queue and votes
|
||||
playerQueue = [];
|
||||
logger.log('info', 'Emptied queue');
|
||||
playerVotes = [];
|
||||
logger.log('info', 'Emptied votes');
|
||||
pokemonName = '';
|
||||
captainInGameName = '';
|
||||
logger.log('info', 'Emptied pokemon name and captain name');
|
||||
}
|
||||
else if (playerQueue.length === 0) {
|
||||
message.channel.send('The queue is empty :(');
|
||||
@@ -175,7 +180,7 @@ function getUserFromMention(mention) {
|
||||
}
|
||||
|
||||
function getChannelName(username) {
|
||||
return `${username.toLowerCase()}s-adventurers`;
|
||||
return `${username.toLowerCase().replace(' ', '-')}s-adventurers`;
|
||||
}
|
||||
|
||||
function makeTempChannel(message, adventureMessage) {
|
||||
@@ -205,15 +210,16 @@ function makeTempChannel(message, adventureMessage) {
|
||||
|
||||
// Post in the channel
|
||||
createdChannel.send(adventureMessage);
|
||||
createdChannel.send(`Please delete this channel when you're finished with it using the ${config.prefix}dc command`);
|
||||
})
|
||||
.catch(logger.error);
|
||||
|
||||
try {
|
||||
// Delete the channel after the configured amount of minutes
|
||||
setTimeout(function(){ deleteChannel(message, channelName); }, (config.channeldeletetimeinminutes * 1000 * 60) );
|
||||
} catch (error) {
|
||||
logger.error(`Tried to delete channel ${channelName} after timeout: `, error);
|
||||
}
|
||||
// try {
|
||||
// // Delete the channel after the configured amount of minutes
|
||||
// setTimeout(function(){ deleteChannel(message, channelName); }, (config.channeldeletetimeinminutes * 1000 * 60) );
|
||||
// } catch (error) {
|
||||
// logger.error(`Tried to delete channel ${channelName} after timeout: `, error);
|
||||
// }
|
||||
}
|
||||
|
||||
function deleteChannel(message, channelName) {
|
||||
@@ -328,6 +334,9 @@ client.on('message', function (message) {
|
||||
if(playerQueue.length == 0) {
|
||||
message.channel.send(`You can only vote to start an adventure early if there is a queue. You can start a queue by using the command ${config.prefix}help`);
|
||||
}
|
||||
else if (!playerQueue.includes(message.author)) {
|
||||
message.channel.send(`You can only vote to start an adventure early if you are in the queue. You can join the queue by using the command ${config.prefix}q`);
|
||||
}
|
||||
else if(playerVotes.length == 0) {
|
||||
// First player to vote
|
||||
playerVotes.push(message.author);
|
||||
@@ -377,10 +386,14 @@ client.on('message', function (message) {
|
||||
message.channel.send(`The queue is already empty...`);
|
||||
logger.log('info', `${message.author.username} attempted to clear the queue but it was already empty.`);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
playerQueue = [];
|
||||
playerVotes = [];
|
||||
message.channel.send(`The queue has been cleared!`);
|
||||
logger.log('info', `${message.author.username} cleared the queue.`);
|
||||
logger.log('info', `${message.author.username} cleared the queue and the votes.`);
|
||||
pokemonName = '';
|
||||
captainInGameName = '';
|
||||
logger.log('info', 'Emptied pokemon name and captain name');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,12 +453,12 @@ client.on('message', function (message) {
|
||||
if (command === 'help') {
|
||||
let msg = `
|
||||
The commands available to you are:
|
||||
- ${command}q - Join the queue
|
||||
- ${command}q <pokemon> <ign> - Join the queue (first player can set the pokemon and their in-game name)
|
||||
- ${command}lq - Leave the queue
|
||||
- ${command}sq - Show the queue
|
||||
- ${command}start - Vote to start the adventure early, without the full number of players (all players in the queue must use this to start early)
|
||||
- ${command}dc - Delete an adventure channel (only the captain can use this)
|
||||
- ${config.prefix}q - Join the queue
|
||||
- ${config.prefix}q <pokemon> <ign> - Join the queue (first player can set the pokemon and their in-game name)
|
||||
- ${config.prefix}lq - Leave the queue
|
||||
- ${config.prefix}sq - Show the queue
|
||||
- ${config.prefix}start - Vote to start the adventure early, without the full number of players (all players in the queue must use this to start early)
|
||||
- ${config.prefix}dc - Delete an adventure channel (only the captain can use this)
|
||||
`;
|
||||
|
||||
message.channel.send(msg);
|
||||
@@ -454,14 +467,14 @@ The commands available to you are:
|
||||
if (command === 'adminhelp') {
|
||||
let msg = `
|
||||
The commands available to you are:
|
||||
- ${command}q - Join the queue
|
||||
- ${command}q <pokemon> <ign> - Join the queue (first player can set the pokemon and their in-game name)
|
||||
- ${command}lq - Leave the queue
|
||||
- ${command}sq - Show the queue
|
||||
- ${command}start - Vote to start the adventure early, without the full number of players (all players in the queue must use this to start early)
|
||||
- ${command}cq - Clear the queue (admin-only, not to be shared with normal users)
|
||||
- ${command}ru - Remove a tagged user from the queue (admin-only, not to be shared with normal users)
|
||||
- ${command}dc - Delete an adventure channel (only the captain can use this)
|
||||
- ${config.prefix}q - Join the queue
|
||||
- ${config.prefix}q <pokemon> <ign> - Join the queue (first player can set the pokemon and their in-game name)
|
||||
- ${config.prefix}lq - Leave the queue
|
||||
- ${config.prefix}sq - Show the queue
|
||||
- ${config.prefix}start - Vote to start the adventure early, without the full number of players (all players in the queue must use this to start early)
|
||||
- ${config.prefix}cq - Clear the queue (admin-only, not to be shared with normal users)
|
||||
- ${config.prefix}ru - Remove a tagged user from the queue (admin-only, not to be shared with normal users)
|
||||
- ${config.prefix}dc - Delete an adventure channel (only the captain can use this)
|
||||
`;
|
||||
|
||||
message.channel.send(msg);
|
||||
|
||||
Reference in New Issue
Block a user