Skip to content

Commit

Permalink
Merge pull request #6 from NebulaServices/2.3
Browse files Browse the repository at this point in the history
2.3
  • Loading branch information
joebobbio committed Aug 27, 2022
2 parents d525872 + a067012 commit aecf8ba
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 38 deletions.
22 changes: 22 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Your bot token
TOKEN=

# The ID of the server you are going to add the bot to.
GUILDID=

# The ID of the bot profile
CLIENTID=

# An array of bot owner IDs
OWNERID=

# The text you see in the embeds of footers - i.e. "A Nebula service"
EMBEDFOOTERTEXT=

# These next few values are about reporting. If you leave them blank, the report feature will be disabled.
REPORTWEBHOOK=
REPORTUSERNAME=
REPORTAVATAR=

# The status displayed on your bot profile
STATUS=
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
config.json
database.sqlite
database.sqlite
.env
3 changes: 2 additions & 1 deletion Handler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const dispense = async (client, interaction) => {
usage_count: 0
})
console.log(client.colors.warn('[DB]'), `User ${interaction.user.tag} added to db`)
return interaction.reply({ content: 'You have been added to the database - click the button again.', ephemeral: true })
// return interaction.reply({ content: 'You have been added to the database - click the button again.', ephemeral: true })
return dispense(client, interaction);
}
} catch (err) {
console.log(client.colors.error(err))
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@
<td>/list</td>
</tr>
<tr>
<td>/reset</td>
<td>/reset-all</td>
<td>Resets all users in the database</td>
<td>/reset</td>
</tr>
<tr>
<td>/reset</td>
<td>Reset a user</td>
<td>/reset [user]</td>
</tr>
</tbody>
</table>

Expand All @@ -60,10 +65,10 @@ Installation instructions can be found on the [wiki](https://github.com/NebulaSe

## Credits

Written by [Phene](https://github.com/joebobbio) and [illusions](https://github.com/illusionTBA) for Nebula Services
See our [contributors](https://github.com/NebulaServices/Dispenser/graphs/contributors)

Dispenser is a product of Nebula Services | Copyright Nebula Services 2022
<br>
Copyright Questions ----> accounts-management@nebula.bio
Copyright questions ----> accounts-management@nebula.bio
<br>
Need Help? Open a ticket -> https://discord.nebula.bio
Need help or want to contribute? Open a ticket -> https://discord.nebula.bio
21 changes: 21 additions & 0 deletions commands/reset-all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const {SlashCommandBuilder} = require('@discordjs/builders')
const {Users} = require('../db')
module.exports = {
data: new SlashCommandBuilder()
.setName('reset-all')
.setDescription('Reset ALL USERS'),
ownerOnly: true,
async execute(interaction){
try{
Users.destroy({
where: {}
})
return interaction.reply('All users have been reset.')
}
catch(err){
interaction.reply('Something went wrong. Check the log!')
console.log(client.colors.error(err))
}

}
}
15 changes: 8 additions & 7 deletions commands/reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ const {Users} = require('../db')
module.exports = {
data: new SlashCommandBuilder()
.setName('reset')
.setDescription('Reset ALL USERS'),
.setDescription('Reset a user\'s monthly count')
.addUserOption(option => option.setName('user').setDescription('The user to reset').setRequired(true)),
ownerOnly: true,
async execute(interaction){
try{
const user = interaction.options.getMember('user')
try {
Users.destroy({
where: {}
})
return interaction.reply('All users have been reset.')
where: {id:user.id}
})
return interaction.reply(`Reset user ${user.user.tag}`)
}
catch(err){
interaction.reply('Something went wrong. Check the log!')
interaction.reply('User either does not exist or an unknown error occurred.')
console.log(client.colors.error(err))
}

}
}
14 changes: 0 additions & 14 deletions config-example.json

This file was deleted.

5 changes: 4 additions & 1 deletion deploy-commands.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
require("dotenv").config();
const fs = require('node:fs');
const path = require('node:path');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { clientID, guildID, token } = require('./config.json');
const clientID = process.env.CLIENTID;
const guildID = process.env.guildID;
const token = process.env.TOKEN;
const { colors } = require('./colors');
const commands = [];
const commandsPath = path.join(__dirname, 'commands');
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require("dotenv").config();
const { Client, Collection, Intents } = require('discord.js');
const fs = require('node:fs');
const path = require('node:path');
Expand All @@ -9,7 +10,7 @@ const { loadEvents, loadCommands } = require('./Handler');

// global sexy variables
module.exports = client;
client.config = require('./config.json');
client.config = process.env;
client.Discord = Discord;
client.commands = new Collection();
client.colors = colors;
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neb-dispenser",
"version": "2.1.0",
"version": "2.3.0",
"description": "Distribute domains to a Discord server",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit aecf8ba

Please sign in to comment.