61 Commits
v2.1.1 ... dart

Author SHA1 Message Date
5b808e8873 Updated 2021-05-21 14:29:51 -05:00
9293af28dc MOdern! 2021-05-21 14:23:07 -05:00
Alex
97ca10f53e Ok lets see if I did this right 2021-05-09 17:21:43 -05:00
c9a68dfed6 Update config.dart 2021-05-09 17:41:51 -04:00
0473958a16 Create config.dart 2021-05-09 17:41:19 -04:00
Alex
04472c5192 hiding config file 2021-05-09 16:36:05 -05:00
Alex
6328d8508e Magic 2021-05-09 16:35:08 -05:00
Alex
2f440ec6ff Making this Dart cause dart is cool 2021-05-08 15:44:25 -05:00
Alex
8831641bce remove idea files 2020-11-23 23:04:37 -05:00
c03c964ac0 I did something partaining to ssh deployment
Took 1 minute
2020-08-28 13:02:39 -04:00
889f62d66f I did something...
Took 2 hours 27 minutes
2020-08-28 13:01:17 -04:00
352d001dc2 Merge branch 'master' of https://github.com/Technicolor-creamsicle/Osselbot 2020-07-15 16:05:08 -05:00
Alex
0801ef2ea6 Delete .replit 2020-07-15 09:44:29 -05:00
Alex
4a465bbe95 Delete .npmrc 2020-07-15 09:44:03 -05:00
Alex
7caf8524cb Delete npmpublish.yml 2020-07-15 09:20:39 -05:00
Alex
a19bb6b17e Update README.md 2020-07-15 09:19:40 -05:00
178f93ad3f idk what Idea is doing but its doing something 2020-07-14 14:27:43 -05:00
adc258fb1d Changine help location 2020-07-14 14:04:26 -05:00
4152a32ef7 Merge remote-tracking branch 'origin/master' 2020-07-14 14:00:54 -05:00
494f345d05 Converting to google JS specs 2020-07-14 13:57:24 -05:00
Alex
09fbe7a5d7 Update README.md 2020-07-14 13:47:48 -05:00
Alex
26a1cf9571 Update config.json 2020-07-14 13:45:11 -05:00
Alex
79cc4838e4 Create config.json 2020-07-14 13:42:53 -05:00
5a83b5097d Converting to google JS specs 2020-07-14 13:35:59 -05:00
ffb9e943a5 pain 2020-07-13 14:49:35 -05:00
ab91e14dfc pain 2020-07-13 14:48:45 -05:00
7a96ffe960 Hi John 2020-07-13 13:39:16 -05:00
0c9954a41f UwU 2020-07-12 17:58:26 -05:00
aeb04580e0 UwU 2020-07-12 17:53:39 -05:00
980161af4c UwU 2020-07-12 17:48:47 -05:00
14cd7fd7c9 Merge remote-tracking branch 'origin/master' 2020-07-12 17:45:23 -05:00
Alex
e334febf08 Create config.json 2020-07-12 17:36:09 -05:00
f5bbbdf533 UwU 2020-07-12 15:41:43 -05:00
9f16f04e20 Merge remote-tracking branch 'origin/master' 2020-07-12 15:40:08 -05:00
Alex
3573141963 Delete config.json 2020-07-12 15:39:58 -05:00
97970c23f8 UwU 2020-07-12 15:36:42 -05:00
0796d13937 UwU 2020-07-12 15:07:04 -05:00
a3fe0af8ad Commit message 2020-07-12 13:52:25 -05:00
8544676e74 I seem to be more productive recently 2020-07-12 13:42:01 -05:00
35576298e8 YEET! 2020-07-12 03:03:29 -05:00
f900652347 YEET! 2020-07-12 00:40:41 -05:00
51fdae02d6 MMM 2020-07-11 17:20:36 -05:00
84d1b62309 adding some more verbal abuse 2020-07-10 22:59:38 -05:00
e2b95f5aec fixed the ping command 2020-07-10 20:15:30 -05:00
deb0118652 egg 2020-07-08 16:19:35 -05:00
601dc1755a WoW iM sTuPiD 2020-07-08 12:42:59 -05:00
a8abbd0174 fix? 2020-07-08 00:44:59 -05:00
a3dde7383a Merge branch 'master' of https://github.com/Technicolor-creamsicle/Osselbot 2020-07-08 00:27:13 -05:00
15badc68c8 fix error 2020-07-07 21:25:19 -05:00
ea85a8da9e LJbvdihbnaqp'nm 2020-07-07 03:36:32 +00:00
85398fc4e0 faufn] 2020-06-30 00:11:26 -05:00
0c14891aba aaaa 2020-06-18 23:53:53 -05:00
a9cf34717b fumck 2020-06-18 12:09:29 -05:00
03a9b72247 padres? 2020-06-18 11:48:13 -05:00
d82de68c70 Im done for right now 2020-06-18 03:45:40 -05:00
7af1e4b483 pog 2020-06-18 03:16:08 -05:00
e5a0077ff4 pogger 2020-06-18 03:12:52 -05:00
136b88a77d poggers 2020-06-18 02:06:34 -05:00
e86016c322 Update package.json 2020-06-13 22:51:49 -05:00
4a59ad7103 Update index.js 2020-06-13 22:16:58 -05:00
349ad4d926 Update index.js 2020-06-13 22:15:18 -05:00
21 changed files with 294 additions and 794 deletions

View File

@@ -1,29 +0,0 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test

View File

@@ -1,33 +0,0 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: Node.js Package
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm ci
- run: npm test
publish-gpr:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

21
.gitignore vendored
View File

@@ -1,2 +1,19 @@
node_modules/
.DS_Store
# Files and directories created by pub
.dart_tool/
.packages
# Conventional directory for build outputs
build/
# Directory created by dartdoc
doc/api/
# Vscode settings
.vscode
# MacOS being funky
.DS_Store
# Config file and executeables
lib/config.dart
bin/osselbot.exe

3
.npmrc
View File

@@ -1,3 +0,0 @@
@technicolor-creamsicle:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=415f56140c8bd65b557e518c038b910fe11e3448
prefix=/usr

View File

@@ -1,2 +0,0 @@
language = "nodejs"
run = "npm start"

3
CHANGELOG.md Normal file
View File

@@ -0,0 +1,3 @@
## 1.0.0
- Initial version, created by Stagehand

View File

@@ -1,3 +1,4 @@
# Osselbot
A bot that is kinda stupid but it works surprisingly well
![Node.js CI](https://github.com/Technicolor-creamsicle/Osselbot/workflows/Node.js%20CI/badge.svg)
A simple command-line application.
Created from templates made available by Stagehand under a BSD-style
[license](https://github.com/dart-lang/stagehand/blob/master/LICENSE).

19
analysis_options.yaml Normal file
View File

@@ -0,0 +1,19 @@
# Defines a default set of lint rules enforced for
# projects at Google. For details and rationale,
# see https://github.com/dart-lang/pedantic#enabled-lints.
include: package:pedantic/analysis_options.yaml
# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
# Uncomment to specify additional rules.
linter:
rules:
- camel_case_types
analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
# exclude:
# - path/to/excluded/files/**

111
bin/osselbot.dart Normal file
View File

@@ -0,0 +1,111 @@
import 'dart:async';
import 'dart:math';
import 'package:nyxx/nyxx.dart';
import 'package:nyxx_commander/commander.dart';
import 'package:nyxx_interactions/interactions.dart';
import 'package:osselbot/config.dart';
// import 'package:path/path.dart';
void main(List<String> arguments) {
final bot = Nyxx(Config['token'] as String, 32511);
bot.onReady.listen((event) {
randomStatus(bot);
});
// Change the Activity every 5 minutes
Timer.periodic(Duration(minutes: 5), (timer) => randomStatus(bot));
Interactions(bot)
..registerSlashCommand(SlashCommandBuilder(
'info',
'gives bot info',
[],
)..registerHandler((handler) => infoSlashCommand(handler, bot)))
..syncOnReady();
Commander(bot, prefix: '?')
..registerCommand(
'ping',
(context, message) => {
context.reply(MessageBuilder.content('pong! ' +
bot.shardManager.shards
.elementAt(context.shardId)
.gatewayLatency
.inMilliseconds
.toString() +
'ms'))
})
..registerCommand('info', (context, message) async {
await context.sendMessage(MessageBuilder.embed(
await infoCommand(bot, context.guild, context.shardId)));
});
}
// Bot routines
DiscordColor getColor(Member? member) {
if (member == null) return DiscordColor.black;
member.roles.forEach((element) async {
await element.getOrDownload();
});
var colorRole = member.roles.firstWhere((element) {
if (element.getFromCache()?.color == null) return false;
return element.getFromCache()?.color != DiscordColor.none;
});
return colorRole.getFromCache()!.color;
}
void randomStatus(Nyxx bot) {
var rand = Random();
var statuses = Config['statuses'] as List<String>;
bot.setPresence(PresenceBuilder.of(
status: UserStatus.dnd,
game: Activity.of(statuses[rand.nextInt(statuses.length - 1)])));
}
// Command embeds
// Info
Future<EmbedBuilder> infoCommand(Nyxx bot, Guild? guild, int? shardId) async {
var member = await guild!.fetchMember(bot.self.id);
var color = getColor(member);
var iconUrl = bot.self.avatarURL();
int ping;
if (shardId != null) {
ping = bot.shardManager.shards
.elementAt(shardId)
.gatewayLatency
.inMilliseconds;
} else {
ping = bot.shardManager.gatewayLatency.inMilliseconds;
}
var uptimeString = bot.uptime.toString();
return EmbedBuilder()
..addField(name: 'Ping', content: ping.toString() + 'ms', inline: true)
..addField(
name: 'Uptime',
content: uptimeString.substring(0, uptimeString.length - 7),
inline: true)
..addAuthor((author) {
author.iconUrl = iconUrl;
author.name = bot.self.username;
})
..color = color;
}
// Command helpers
// /info command
Future<void> infoSlashCommand(InteractionEvent event, Nyxx bot) async {
await event.acknowledge();
await event.respond(MessageBuilder.embed(await infoCommand(
bot, await event.interaction.guild!.getOrDownload(), null)));
}

3
lib/config.dart Normal file
View File

@@ -0,0 +1,3 @@
Map<String, dynamic> Config = <String, dynamic>{
'token': 'EXAMPLE TOKEN',
};

125
npm-shrinkwrap.json generated
View File

@@ -1,125 +0,0 @@
{
"name": "@technicolor-creamsicle/osselbot",
"version": "2.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@discordjs/collection": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.5.tgz",
"integrity": "sha512-CU1q0UXQUpFNzNB7gufgoisDHP7n+T3tkqTsp3MNUkVJ5+hS3BCvME8uCXAUFlz+6T2FbTCu75A+yQ7HMKqRKw=="
},
"@discordjs/form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@discordjs/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-ZfFsbgEXW71Rw/6EtBdrP5VxBJy4dthyC0tpQKGKmYFImlmmrykO14Za+BiIVduwjte0jXEBlhSKf0MWbFp9Eg==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
},
"abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
"requires": {
"event-target-shim": "^5.0.0"
}
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"requires": {
"delayed-stream": "~1.0.0"
}
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
},
"discord.js": {
"version": "12.2.0",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.2.0.tgz",
"integrity": "sha512-Ueb/0SOsxXyqwvwFYFe0msMrGqH1OMqpp2Dpbplnlr4MzcRrFWwsBM9gKNZXPVBHWUKiQkwU8AihXBXIvTTSvg==",
"requires": {
"@discordjs/collection": "^0.1.5",
"@discordjs/form-data": "^3.0.1",
"abort-controller": "^3.0.0",
"node-fetch": "^2.6.0",
"prism-media": "^1.2.0",
"setimmediate": "^1.0.5",
"tweetnacl": "^1.0.3",
"ws": "^7.2.1"
}
},
"event-target-shim": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
},
"mime-db": {
"version": "1.44.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
},
"mime-types": {
"version": "2.1.27",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
"requires": {
"mime-db": "1.44.0"
}
},
"n": {
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/n/-/n-6.5.1.tgz",
"integrity": "sha512-CSDShHuBlYHfS5PR4BxwkZYNrDnc3B7GCRdAhSvnzl681Pd4Y4qOOTWQqjB8Cp6gYOIQI9qJxLK0Q1YI4xO2Kg=="
},
"node-fetch": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
},
"parse-ms": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz",
"integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA=="
},
"pretty-ms": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-6.0.1.tgz",
"integrity": "sha512-ke4njoVmlotekHlHyCZ3wI/c5AMT8peuHs8rKJqekj/oR5G8lND2dVpicFlUz5cbZgE290vvkMuDwfj/OcW1kw==",
"requires": {
"parse-ms": "^2.1.0"
}
},
"prism-media": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.2.2.tgz",
"integrity": "sha512-I+nkWY212lJ500jLe4tN9tWO7nRiBAVdMv76P9kffZjYhw20raMlW1HSSvS+MLXC9MmbNZCazMrAr+5jEEgTuw=="
},
"setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
},
"tweetnacl": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",
"integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="
},
"ws": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.3.0.tgz",
"integrity": "sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w=="
}
}
}

View File

@@ -1,12 +0,0 @@
#!/usr/bin/env bash
echo "Updating"
#Update Node Based stuff
cd /home/ec2-user/github/Osselbot/
nvm node
npm upgrade
#update code
git pull --force
#Starts the bot
cd ./src
echo "STARTING"
node index.js

View File

@@ -1,286 +0,0 @@
// Here we load the config.json file that contains our token and our prefix values.
const config = require("./config.json");
// config.token contains the bot's token
// config.prefix contains the message prefix.
//Activity setting
client.on('guildMemberAdd', member => {
console.log(`New member joined: ${member.name} (id: ${member.id}).`);
client.user.setActivity(`${client.users.cache.size} of you horrible people`,{ type: 'LISTENING' });
});
client.on('guildMemberRemove', member => {
console.log(` member left: ${member.name} (id: ${member.id}).`);
client.user.setActivity(`${client.users.cache.size} of you horrible people`,{ type: 'LISTENING' });
});
client.on("guildDelete", guild => {
// this event triggers when the bot is removed from a guild.
console.log(`I have been removed from: ${guild.name} (id: ${guild.id})`);
client.user.setActivity(`${client.users.cache.size} of you horrible people`,{ type: 'LISTENING' });
});
//Actual command stuff
client.on("message", async message => {
// This event will run on every single message received, from any channel or DM.
// It's good practice to ignoe other bots. This also makes your bot ignore itself
// and not get into a spam loop (we call that "botception ").
if(message.author.bot) return;
//people are assholes so this blocks it!
if(message.content.toLowerCase().includes('nigger',"nigga","niglet","nigglet")){
message.member.roles.add('654366653093642241').catch(console.error);
message.member.roles.remove('514254335425773589').catch(console.error);
console.log(`${message.member} has been detained`)
return message.reply('Member has been D E T A I N E D <:yikes:632660765878255636>')
}
// Also good practice to ignore any message that does not start with our prefix,
// which is set in the configuration file.
if(message.content.indexOf(config.prefix) !== 0) return;
// Here we separate our "command" name, and our "arguments" for the command.
// e.g. if we have the message "+say Is this the real life?" , we'll get the following:
// command = say
// args = ["Is", "this", "the", "real", "life?"]
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
// Let's go with a few common example commands! Feel free to delete or change those.
if(command === "ping") {
// Calculates ping between sending a message and editing it, giving a nice round-trip latency.
// The second ping is an average latency between the bot and the websocket server (one-way, not round-trip)
const m = await message.channel.send("Ping?");
m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms`);
}
if(command === "say") {
// makes the bot say something and delete the message. As an example, it's open to anyone to use.
// To get the "message" itself we join the `args` back into a string with spaces:
const sayMessage = args.join(" ");
if (message.member.roles.cache.some(r=>["Admin", "Mods","Member of the Order of the b l u e","Botmeister","Ally of the Order","say"].includes(r.name)) ){
if(sayMessage.includes('@')) {
return message.reply("\nStop pinging yourself \nStop pinging yourself");
}
// Then we delete the command message (sneaky, right?). The catch just ignores the error with a cute smiley thing.
message.delete().catch(O_o=>{});
// And we get the bot to say the thing:
return message.channel.send(sayMessage);
}
else {
return message.channel.send("Im sorry but we cant have nice things...")
}
}
if(command === "kick") {
// This command must be limited to mods and admins. In this example we just hardcode the role names.
// Please read on Array.some() to understand this bit:
// https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/some?
if(!message.member.roles.cache.some(r=>["Admin", "Moderator","Member of the Order of the b l u e","Botmeister"].includes(r.name)) )
return message.reply("Sorry, you don't have permissions to use this!");
// Let's first check if we have a member and if we can kick them!
// message.mentions.members is a collection of people that have been mentioned, as GuildMembers.
// We can also support getting the member by ID, which would be args[0]
let member = message.mentions.members.first() || message.guild.members.get(args[0]);
if(!member)
return message.reply("Please mention a valid member of this server");
if(!member.kickable)
return message.reply("I cannot kick this user! Do they have a higher role? Do I have kick permissions?");
// slice(1) removes the first part, which here should be the user mention or ID
// join(' ') takes all the various parts to make it a single string.
let reason = args.slice(1).join(' ');
if(!reason) reason = "No reason provided";
// Now, time for a swift kick in the nuts!
await member.kick(reason)
.catch(error => message.reply(`Sorry ${message.author} I couldn't kick because of : ${error}`));
message.reply(`${member.user.tag} has been kicked by ${message.author.tag} because: ${reason}`);
}
if(command === "ban") {
// Most of this command is identical to kick, except that here we'll only let admins do it.
// In the real world mods could ban too, but this is just an example, right? ;)
if(!message.member.roles.cache.some(r=>["Administrator","Member of the Order of the b l u e"].includes(r.name)) )
return message.reply("Sorry, you don't have permissions to use this!");
let member = message.mentions.members.first();
if(!member)
return message.reply("Please mention a valid member of this server");
if(!member.bannable)
return message.reply("I cannot ban this user! Do they have a higher role? Do I have ban permissions?");
let reason = args.slice(1).join(' ');
if(!reason) reason = "No reason provided";
await member.ban(reason)
.catch(error => message.reply(`Sorry ${message.author} I couldn't ban because of : ${error}`));
message.reply(`${member.user.tag} has been banned by ${message.author.tag} because: ${reason}`);
}
if(command === "purge") {
//Vibe check
if(!message.member.roles.cache.some(r=>["Admin","Member of the Order of the b l u e","Botmeister"].includes(r.name)) )
return message.reply("Sorry, you don't have permissions to use this!");
// This command removes all messages from all users in the channel, up to 100.
else {
// get the delete count, as an actual number.
const deleteCount = parseInt(args[0], 10);
// Ooooh nice, combined conditions. <3
if(!deleteCount || deleteCount < 2 || deleteCount > 100)
return message.reply("Please provide a number between 2 and 100 for the number of messages to delete");
// So we get our messages, and delete them. Simple enough, right?
const fetched = await message.channel.messages.fetch({limit: deleteCount});
message.channel.bulkDelete(fetched)
.catch(error => message.reply(`Couldn't delete messages because of: ${error}`));
}
};
if(command === "detain") {
//For Civilians all partying
if(!message.member.roles.cache.some(r=>["Admin","Member of the Order of the b l u e","Botmeister"].includes(r.name)) )
return message.reply("Sorry, you don't have permissions to use this!");
let member = message.mentions.members.first();
if(!member)
return message.reply("Please mention a valid member of this server");
else {
member.roles.add('654366653093642241').catch(console.error);
member.roles.remove('514254335425773589').catch(console.error);
return message.reply("Member has been D E T A I N E D<:yikes:632660765878255636>\n**DEFCON** level increased\nGod Bless their souls")
}
}
if(command === "retain") {
//For Civilians all partying
if(!message.member.roles.cache.some(r=>["Admin","Member of the Order of the b l u e","Botmeister"].includes(r.name)) )
return message.reply("Sorry, you don't have permissions to use this!");
let member = message.mentions.members.first();
if(!member)
return message.reply("Please mention a valid member of this server");
else {
member.roles.add('514254335425773589').catch(console.error);
member.roles.remove('654366653093642241').catch(console.error);
return message.reply("Member has been R E T A I N E D <:MilkTurtle:628399622678773760>")
}
}
// HERE COMES SHITTY COMMANDS MADE BY YOURS TRUELY
if(command === 'help') {
return message.reply('https://technicolor.2a03.party/bot/');
};
if(command === "rand") {
//Generates random number between 1-100
min = Math.ceil(0);
max = Math.floor(101);
return message.channel.send(Math.floor(Math.random() * (max - min)) + min); //The maximum is exclusive and the minimum is inclusive
};
if(command === "oath") {
return message.reply("The cadet oath is as follows.\nI pledge that I will serve faithfully in the Civil Air Patrol cadet program. That I will attend meetings regularly, wear my uniform properly, obey my officers, and advance my education and training rapidly to prepare myself to be of service to my community state and nation.");
};
if(command === "ask") {
return message.channel.send("Dont Ask, Just ask!\n https://iki.fi/sol/dontask.html")
};
if(command === "damage") {
return message.channel.send("https://cdn.discordapp.com/attachments/619631814696239142/678467158660874270/ohmydamage.mov")
};
if(command === "osseley") {
return message.channel.send("Ohhh Osseley,\n how I missed you sooo much \nOne of these days...")
};
if(command === "psych") {
return message.channel.send("Rules for finding a psychopath: \n1. Favorite color is orange \n2. Likes the left burners, worse if its top left\n3. Calls pizza sauce/tomato sauce gravy\n4. Doesnt like salad\n5. Likes country music\n6. Makes hot chocolate with water\n7. Likes black licorice")
};
if(command === "squad") {
min = Math.ceil(0);
max = Math.floor(11);
let rate = Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive
return message.reply(`The squad rates this ${rate} out of 10`);
};
if(command === "magic") {
return message.channel.send("Do you believe in magic in a young girl\'s heart\nHow the music can free her, whenever it starts\nAnd it\'s magic, if the music is groovy\nIt makes you feel happy like an old-time movie\nI\'ll tell you about the magic, and it\'ll free your soul\nBut it\'s like trying to tell a stranger bout \'rock and roll\'")
}
if(command === "simp") {
if(!message.member.roles.cache.some(r=>["Admin", "Moderator","Member of the Order of the b l u e","Botmeister"].includes(r.name)) )
return message.reply("Sorry, you don't have permissions to use this!");
let embed = new Discord.MessageEmbed()
.setTitle("SIMP Alert")
.setURL("https://www.youtube.com/watch?v=c3m4Q07TkMk")
.setColor(0x195080)
.setDescription("__**ALERT**__ SIMP detected!")
.setImage("https://vignette.wikia.nocookie.net/disney/images/6/64/Kronk_.jpg/revision/latest?cb=20160720194635")
.setTimestamp()
message.channel.send({embed})
}
//DEFCON Roles
if(command === "defcon") {
//5 levels till ban
if(!message.member.roles.cache.some(r=>["Admin","Member of the Order of the b l u e","Botmeister"].includes(r.name)) )
return message.reply("Sorry, you don't have permissions to use this!");
else {
let member = message.mentions.members.first();
var role = "";
switch(parseInt(args[1],10)) {
case 5:
var role = message.guild.roles.cache.find(role => role.name === `DEFCON 5`);
member.roles.add(role);
break;
case 4:
var role = message.guild.roles.cache.find(role => role.name === `DEFCON 4`);
member.roles.add(role);
break;
case 3:
var role = message.guild.roles.cache.find(role => role.name === `DEFCON 3`);
member.roles.add(role);
break;
case 2:
var role = message.guild.roles.cache.find(role => role.name === `DEFCON 2`);
member.roles.add(role);
break;
case 1:
var role = message.guild.roles.cache.find(role => role.name === `DEFCON 1`);
member.roles.add(role);
break;
default:
return message.reply(`DEFCON not set is ${args[1]} a number between 1-5?`)
};
return message.reply(`\n**DEFCON** level set to DEFCON ${args[1]}\nGod Bless their souls`)
};
};
if (command === "fix") {
if(message.member.roles.cache.some(r=>["Botmeister"].includes(r.name))) {
return message.channel.send("I guess it\'s my fault will fix.");
};
return;
};
if (command === "stats") {
let embed = new Discord.MessageEmbed()
.setTitle('Stats')
.setColor(0x195080)
.setDescription(`\
**Stats for 0SSELB0T** \n \
**Uptime:** ${prettyMilliseconds(client.uptime)} \n \
**Started at:** ${client.readyAt} \n \
**People:** ${client.users.cache.size}\
`);
return message.channel.send(embed);
};
if (command === "reboot"){
function shutdown(){
client.destroy();
process.exit(69);
}
if (message.author.id === '216042720047661057') {
message.reply("**Authenticated**, Restarting now.");
client.user.setActivity(`Itself die`,{ type: 'WATCHING' });
setTimeout(shutdown, 5000, 'shutdown');
}
else {
return message.reply("No");
};
};
});
client.login(config.token)

View File

@@ -1,17 +0,0 @@
[Unit]
Description="Osselbot coded for civilians all partying"
[Service]
Type=simple
ExecStart=/home/ec2-user/Osselbot/src/bot-start.sh
Restart=on-failure
RestartSec=5s
User=ec2-user
# Note Debian/Ubuntu uses 'nogroup', RHEL/Fedora uses 'nobody'
Group=nobody
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/home/ec2-user/Osselbot/src/
[Install]
WantedBy=multi-user.target

View File

@@ -1,2 +0,0 @@
DEPRICATED

View File

@@ -1,35 +0,0 @@
{
"name": "@technicolor-creamsicle/osselbot",
"version": "2.1.0",
"description": "A discord bot on Discord.js",
"main": "index.js",
"dependencies": {
"discord.js": "^12.1.1",
"n": "^6.4.0",
"pretty-ms": "^6.0.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"bin": {
"osselbot": "./src/index.js"
},
"files": [
"/src/"
],
"devDependencies": {},
"scripts": {
"test": "node ./src/index --TEST",
"start": "node ./src/index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Technicolor-creamsicle/Osselbot.git"
},
"author": "Alex Technicolor <technicolor@2a03.party> (http://technicolor.2a03.party)",
"license": "SEE LICENSE IN LICENCE",
"bugs": {
"url": "https://github.com/Technicolor-creamsicle/Osselbot/issues"
},
"homepage": "https://technicolor.2a03.party/bot"
}

117
pubspec.lock Normal file
View File

@@ -0,0 +1,117 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.7.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
nyxx:
dependency: "direct main"
description:
name: nyxx
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0-rc.5"
nyxx_commander:
dependency: "direct main"
description:
name: nyxx_commander
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0-rc.8"
nyxx_interactions:
dependency: "direct main"
description:
name: nyxx_interactions
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0-rc.6"
path:
dependency: "direct main"
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
pedantic:
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
sdks:
dart: ">=2.12.0 <3.0.0"

18
pubspec.yaml Normal file
View File

@@ -0,0 +1,18 @@
name: osselbot
description: A stupid discord bot made for stupid people.
version: 3.0.0
homepage: https://nicolor.tech/bot
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
nyxx: ^2.0.0-rc.5
nyxx_interactions: ^2.0.0-rc.5
nyxx_commander: ^2.0.0-rc.5
path: ^1.7.0
dev_dependencies:
pedantic: ^1.9.0

View File

@@ -1 +0,0 @@
{"quotes":["you can add quotes by running ?quote add <person> Quote goes here","techt parm arm zarm","<@!258325046869622785> I HATE JS."]}

View File

@@ -1,4 +0,0 @@
{
"token" : "Njc4MDkzNjY4NzcwNTEyOTE3.Xr7SNw.XS_D_dEJ7hX6N5Rmnfr_OQpfznU",
"prefix" : "?"
}

View File

@@ -1,240 +0,0 @@
#!/usr/bin/env node
// Load up the libraries
const Discord = require("discord.js");
const prettyMilliseconds = require('pretty-ms');
const fs = require('fs');
const homedir = require('os').homedir;
const info = require("../package.json")
//importing files
const config = require("./config.json");
// This is making clients
const client = new Discord.Client();
function activity() {
client.user.setActivity(`${client.users.cache.size} of you horrible people`,{ type: 'LISTENING' });
};
client.on("ready", () => {
// This event will run if the bot starts, and logs in, successfully.
console.log(`Bot has started, with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`);
// Example of changing the bot's playing game to something useful. `client.user` is what the
// docs refer to as the "ClientUser".
activity();
});
//Updates people count
client.on('guildMemberAdd', member => {
console.log(`New member joined: ${member.name} (id: ${member.id}).`);
activity();
});
client.on('guildMemberRemove', member => {
console.log(` member left: ${member.name} (id: ${member.id}).`);
activity();
});
setInterval(activity, 300000);
////// ACTUAL MESSAGE PROCESSING
client.on("message", async message => {
//stops bots from activating the Osselbot
//Message processing
if(message.content.toLowerCase().includes('nigg',"niglet","negro","fag","f4g","n1gg","gg3r")) {
message.delete();
return message.reply(`Listen here cum-sock we dont appeciate that here ${message.member}. If you gonna be like that you may just well end up in the JAR and we all know how that ends...`)
}
if(message.author.bot) return;
if(message.content.indexOf(config.prefix) !== 0) return;
// Here we separate our "command" name, and our "arguments" for the command.
// e.g. if we have the message "+say Is this the real life?" , we'll get the following:
// command = say
// args = ["Is", "this", "the", "real", "life?"]
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
//////////////////////////////////////////////////////////////////////////////
//COMMAND TIME
//////////////////////////////////////////////////////////////////////////////
if (command === "reboot"){
function shutdown(){
client.destroy();
process.exit(69);
}
if (message.author.id === '216042720047661057') {
message.reply("**Authenticated**, Restarting now.");
client.user.setActivity(`Itself die`,{ type: 'WATCHING' });
setTimeout(shutdown, 5000, 'shutdown');
}
else {
return message.reply("No");
};
};
//////////////////////////////////////////////////////////////////////////////
if (command === "stats") {
let embed = new Discord.MessageEmbed()
.setTitle('Stats')
.setAuthor("Osselbot", "https://cdn.discordapp.com/attachments/597814181084921866/711843993914310656/animated-beach-balls-29.gif")
.setColor(0x195080)
.setDescription(`\
**Stats for 0SSELB0T** \n \
**Uptime:** ${prettyMilliseconds(client.uptime)} \n \
**Started at:** ${client.readyAt} \n \
**People:** ${client.users.cache.size}`)
.setFooter(`osselbot v${info.version} run version for full info`);
return message.channel.send(embed);
};
//////////////////////////////////////////////////////////////////////////////
if(command === "ping") {
// Calculates ping between sending a message and editing it, giving a nice round-trip latency.
const m = await message.channel.send("Ping?");
m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms`);
};
//////////////////////////////////////////////////////////////////////////////
//HOW QUOTEABLE
if(command === "psych") {
return message.channel.send("Rules for finding a psychopath: \n1. Favorite color is orange \n2. Likes the left burners, worse if its top left\n3. Calls pizza sauce/tomato sauce gravy\n4. Doesnt like salad\n5. Likes country music\n6. Makes hot chocolate with water\n7. Likes black licorice")
};
if(command === "ask") {
return message.channel.send("Dont Ask, Just ask!\n https://iki.fi/sol/dontask.html")
};
if(command === "simp") {
if(!message.member.roles.cache.some(r=>["Admin", "Moderator","Member of the Order of the b l u e","Botmeister"].includes(r.name)) )
return message.reply("Sorry, you don't have permissions to use this!");
let embed = new Discord.MessageEmbed()
.setTitle("SIMP Alert")
.setURL("https://www.youtube.com/watch?v=c3m4Q07TkMk")
.setColor(0x195080)
.setDescription("__**ALERT**__ SIMP detected!")
.setImage("https://vignette.wikia.nocookie.net/disney/images/6/64/Kronk_.jpg/revision/latest?cb=20160720194635")
.setTimestamp()
message.channel.send({embed})
};
if(command === "squad") {
min = Math.ceil(0);
max = Math.floor(11);
let rate = Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive
return message.reply(`The squad rates this ${rate} out of 10`);
};
if(command === "magic") {
return message.channel.send("Do you believe in magic in a young girl\'s heart\nHow the music can free her, whenever it starts\nAnd it\'s magic, if the music is groovy\nIt makes you feel happy like an old-time movie\nI\'ll tell you about the magic, and it\'ll free your soul\nBut it\'s like trying to tell a stranger bout \'rock and roll\'");
};
if(command === 'help') {
return message.reply('https://technicolor.2a03.party/bot/');
};
if (command === "fix") {
if(message.member.roles.cache.some(r=>["Botmeister"].includes(r.name))) {
return message.channel.send("I guess it\'s my fault will fix.");
};
return;
};
////////////////////////////////////////////////////////////////////////////////
if(command === "say") {
// makes the bot say something and delete the message. As an example, it's open to anyone to use.
// To get the "message" itself we join the `args` back into a string with spaces:
const sayMessage = args.join(" ");
if (message.member.roles.cache.some(r=>["Admin","Mods","Member of the Order","Botmeister","Ally of the Order","say"].includes(r.name)) ){}
// Then we delete the command message (sneaky, right?). The catch just ignores the error with a cute smiley thing.
message.delete().catch(O_o=>{});
// And we get the bot to say the thing:
return message.channel.send(sayMessage);
};
////////////////////////////////////////////////////////////////////////////////
if(command === "quote") {
let quotes = require(`${homedir}/quotes.json`);
var quoteadd = "";
var selector;
try{
selector = args[0].toLowerCase();
} catch (err) {
var number = quotes.quotes.length + 1;
let quotesend = Math.floor(Math.random() * (number - 0) + 0);
return message.channel.send(`${quotes.quotes[quotesend]}`);
};
if(selector === "add") {
if (!(message.member.roles.cache.some(r => ["Admin","Mods","Member of the Order","Botmeister","Ally of the Order","say"].includes(r.name)))) return message.reply("Ask someone with the quote role to add that.")
args.shift();
//This does logic to make it from an array to a nice string.
quoteadd = args.join(' ');
quotes.quotes.push(quoteadd)
fs.writeFile(`${homedir}/quotes.json`, JSON.stringify(quotes, null, 2), (err) => {
if (err) return message.reply("Something went wrong");``
client.channels.cache.get('712084662033580064').send(`${message.member} has submitted \`${quoteadd}\` to the quote repository`);
return message.reply("Quote added to repository");
});
}
else {
return message.reply("you can add quotes by running `?quote add <person> Quote goes here`");
};
};
////////////////////////////////////////////////////////////////////////////////
if (command === "version") {
return message.channel.send(`\`\`\`\
________________________________________\n \
< @technicolor-creamsicle/osselbot@v${info.version}>\n \
----------------------------------------\n \
\\ ^__^\n \
\\ (oo)\\_______\n \
(__)\\ )\\/\\\n \
||----w |\n \
|| ||\n \
\`\`\``)
};
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////DEFCON//////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
if(command === "defcon") {
//5 levels till ban
if(!message.member.roles.cache.some(r=>["Admin","Member of the Order of the b l u e","Botmeister"].includes(r.name)) )
return message.reply("Sorry, you don't have permissions to use this!");
else {
let member = message.mentions.members.first();
var role = "";
switch(parseInt(args[1],10)) {
case 5:
var role = message.guild.roles.cache.find(role => role.name === `DEFCON 5`);
member.roles.add(role);
break;
case 4:
var role = message.guild.roles.cache.find(role => role.name === `DEFCON 4`);
member.roles.add(role);
break;
case 3:
var role = message.guild.roles.cache.find(role => role.name === `DEFCON 3`);
member.roles.add(role);
break;
case 2:
var role = message.guild.roles.cache.find(role => role.name === `DEFCON 2`);
member.roles.add(role);
break;
case 1:
var role = message.guild.roles.cache.find(role => role.name === `DEFCON 1`);
member.roles.add(role);
break;
default:
return message.reply(`DEFCON not set is ${args[1]} a number between 1-5?`)
};
return message.reply(`\n**DEFCON** level set to DEFCON ${args[1]}\nGod Bless their souls`)
};
};
});
if(process.argv.slice(2).includes("--TEST")) {
console.log("Test Pass!");
process.exit(0);
};
//Logging in the bot
client.login(config.token)