Compare commits
No commits in common. "master" and "gh-pages" have entirely different histories.
21
LICENSE
21
LICENSE
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021 Sophia Atkinson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1 @@
|
|||
theme: jekyll-theme-dinky
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"prefix": "!",
|
||||
|
||||
"token": "!"
|
||||
}
|
52
index.js
52
index.js
|
@ -1,52 +0,0 @@
|
|||
const Discord = require('discord.js');
|
||||
const { prefix, token } = require('./config.json');
|
||||
const client = new Discord.Client();
|
||||
|
||||
client.once('ready', () => {
|
||||
console.log('Ready')
|
||||
|
||||
client.user.setActivity("!help", {
|
||||
//STREAMING,WATCHING,LISTENING,PLAYING
|
||||
type: "STREAMING",
|
||||
//Only for streaming ↓
|
||||
url: "https://www.twitch.tv/user"
|
||||
});
|
||||
})
|
||||
client.on('message', message => {
|
||||
//If you want to log every message from every server, remove the // below
|
||||
//console.log(message.content);
|
||||
//prefix you set in config.json ↓
|
||||
if (message.content.startsWith(`${prefix}test`))
|
||||
message.channel.send("This test works")
|
||||
|
||||
//ban
|
||||
if (message.content.startsWith(`${prefix}ban`)) {
|
||||
if (!message.guild.member(message.author).hasPermission('BAN_MEMBERS')) { return message.channel.send('You do not have permission to ban users!'); }
|
||||
|
||||
if (!message.guild.member(client.user).hasPermission('BAN_MEMBERS')) { return message.channel.send('I don\'t have the permission for ban users!'); }
|
||||
|
||||
if (message.mentions.users.size === 0) { return message.channel.send('You need to mention a user!'); }
|
||||
let banMember = message.guild.member(message.mentions.users.first());
|
||||
if (!banMember) { return message.channel.send('User not found!'); }
|
||||
|
||||
banMember.ban().then((member) => {
|
||||
message.channel.send(member.displayName + " has been successfully kicked from the server.");
|
||||
})
|
||||
}
|
||||
//kick
|
||||
if (message.content.startsWith(`${prefix}kick`)) {
|
||||
if (!message.guild.member(message.author).hasPermission('KICK_MEMBERS')) { return message.channel.send('You do not have permission to kick users!'); }
|
||||
|
||||
if (!message.guild.member(client.user).hasPermission('KICK_MEMBERS')) { return message.channel.send('I don\'t have the permission for kick users!'); }
|
||||
|
||||
if (message.mentions.users.size === 0) { return message.channel.send('You need to mention a user!'); }
|
||||
let kickMember = message.guild.member(message.mentions.users.first());
|
||||
if (!kickMember) { return message.channel.send('User not found!'); }
|
||||
|
||||
kickMember.kick().then((member) => {
|
||||
message.channel.send(member.displayName + " has been successfully kicked from the server.");
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
client.login(token);
|
|
@ -1,23 +1,20 @@
|
|||
# discord-bot
|
||||
Discord bot code
|
||||
|
||||
This is simple Discord bot code
|
||||
it's discord.js
|
||||
|
||||
|
||||
|
||||
This is what the bot code can do, it can do simple commands, and it can show a status.
|
||||
If you want more functionality you can go to the [Discord.js Docs](https://discord.js.org) and you can add more.
|
||||
If you want more functionality you can go to [Discord.js Docs](https://discord.js.org) and you can add more.
|
||||
|
||||
**If you want to run/use it**
|
||||
you will need to download node.js, *Download the most recent* [Download](https://nodejs.org/en/), and install it.
|
||||
and to make your life easier please download Microsoft Visual Studios Code [Download](https://code.visualstudio.com/)
|
||||
|
||||
then go ahead and click your windows key and type **cmd** and click enter.
|
||||
It should open a command prompt, do **CD Desktop**, then do **mkdir code && CD code**. Then we will make one more folder, do **mkdir disbot && CD disbot**.
|
||||
then go ahead and click your windows key and type **cmd** and click enter
|
||||
it should open a command prompt, do **CD Desktop**, then do **mkdir code && CD code**. Then we will make one more folder, do **mkdir disbot && CD disbot**.
|
||||
do **npm init** and click enter for all, it will say is this ok? (yes) just click enter again.
|
||||
do **code.** what that will do is open Visual Studios Code.
|
||||
Now we will be installing the dependencies, to do this do **npm install discord.js**. if you see warn don't mind it's ok.
|
||||
Now we will be installing the dependencies, to do this do **npm install discord.js --save**. if you see warn don't mind it's ok.
|
||||
if you check Visual Studios Code there will be a new folder called node_modules, you won't need to mess with anything in there.
|
||||
|
||||
Before we go any further I need you to make a bot go to [Dev Portal](https://discord.com/developers/applications) and make a bot
|
||||
|
@ -34,5 +31,5 @@ In config.json it says
|
|||
|
||||
for prefix change it to what you want, or keep it default, the prefix is used so the bot knows you are talking to it.
|
||||
for the token, you will take the token you see in bot in your app, replace the ! with your token.
|
||||
then run the run.cmd and test it out. If it does not work join my discord server and I can help out https://discord.com/invite/v64BQYNPrQ
|
||||
then run the run.cmd and test it out. If it does not work join my discord server and I can help out https://discord.com/invite/dVhaH8kw5V
|
||||
Thanks for reading through the documentation, sorry for it being long.
|
Reference in New Issue