mirror of
https://github.com/Technicolor-creamsicle/Osselbot.git
synced 2025-10-21 13:14:23 -04:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
c8e2828043 | |||
167d69e564 | |||
b155c84cfc | |||
|
7ff29383a2 | ||
2b98f98b1c | |||
41d0ad4f58 | |||
793239ed36 | |||
000a629bff | |||
be11882ba4 | |||
cc72efadce | |||
f490760d11 | |||
b3b6da7775 | |||
51b5d48d4a | |||
2825436969 | |||
|
ccb79f1233 | ||
|
866756dfb2 | ||
|
9cef57c075 | ||
|
e0d2b5d291 | ||
|
80c6a2fe8c | ||
5c2692b660 | |||
3f9532cf56 | |||
91f4c849eb | |||
b0d6c6490e | |||
dac06d57e1 | |||
6732fe4db5 |
17
.github/workflows/dockerimage.yml
vendored
17
.github/workflows/dockerimage.yml
vendored
@@ -1,17 +0,0 @@
|
||||
name: Docker Image CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build the Docker image
|
||||
run: docker build . --file Dockerfile --tag osselbot:$(date +%s)
|
20
.github/workflows/dockerpub.yml
vendored
20
.github/workflows/dockerpub.yml
vendored
@@ -1,20 +0,0 @@
|
||||
name: Publish Docker image
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
name: Push Docker image to GitHub Packages
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Push to GitHub Packages
|
||||
uses: docker/build-push-action@v1
|
||||
with:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: docker.pkg.github.com
|
||||
repository: techniclor-creamsicle/osselbot/osselbot
|
||||
tag_with_ref: true
|
20
.github/workflows/dockerpub3.yml
vendored
20
.github/workflows/dockerpub3.yml
vendored
@@ -1,20 +0,0 @@
|
||||
name: Publish Docker image
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
name: Push Docker image to GitHub Packages
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Push to GitHub Packages
|
||||
uses: docker/build-push-action@v1
|
||||
with:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: docker.pkg.github.com
|
||||
repository: techniclor-creamsicle/osselbot/osselbot
|
||||
tag_with_ref: true
|
29
.github/workflows/nodejs.yml
vendored
Normal file
29
.github/workflows/nodejs.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# 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
|
33
.github/workflows/npmpublish.yml
vendored
Normal file
33
.github/workflows/npmpublish.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
# 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}}
|
3
.npmrc
Normal file
3
.npmrc
Normal file
@@ -0,0 +1,3 @@
|
||||
@technicolor-creamsicle:registry=https://npm.pkg.github.com/
|
||||
//npm.pkg.github.com/:_authToken=415f56140c8bd65b557e518c038b910fe11e3448
|
||||
prefix=/usr
|
17
Dockerfile
17
Dockerfile
@@ -1,17 +0,0 @@
|
||||
# Use the official image as a parent image.
|
||||
FROM node:current-slim
|
||||
|
||||
# Set the working directory.
|
||||
WORKDIR ./DOCKER
|
||||
|
||||
# Copy the file from your host to your current location.
|
||||
COPY ./package.json .
|
||||
COPY ./package-lock.json .
|
||||
# Run the command inside your image filesystem.
|
||||
RUN npm install
|
||||
|
||||
# Run the specified command within the container.
|
||||
CMD [ "npm", "start" ]
|
||||
|
||||
# Copy the rest of your app's source code from your host to your image filesystem.
|
||||
COPY ./src/ .
|
@@ -1,5 +1,3 @@
|
||||
# Osselbot
|
||||
A bot that is kinda stupid but it works surprisingly well
|
||||
|
||||
|
||||

|
||||

|
||||
|
10
build.sh
10
build.sh
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#logs in as Alex
|
||||
cat ~/.GHTOKEN | docker login https://docker.pkg.github.com -u technicolor-creamsicle --password-stdin
|
||||
#Builds the package
|
||||
docker build --tag osselbot .
|
||||
#pushes to github
|
||||
docker tag osselbot:latest docker.pkg.github.com/techniclor-creamsicle/osselbot/osselbot:$1
|
||||
docker push docker.pkg.github.com/techniclor-creamsicle/osselbot/osselbot:$1
|
||||
|
||||
echo build may have passed using version: $1
|
4
package-lock.json → npm-shrinkwrap.json
generated
4
package-lock.json → npm-shrinkwrap.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "osselbot",
|
||||
"version": "1.1.0",
|
||||
"name": "@technicolor-creamsicle/osselbot",
|
||||
"version": "2.0.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
@@ -1,5 +1,2 @@
|
||||
const { ShardingManager } = require('discord.js');
|
||||
const manager = new ShardingManager('./bot.js', { token: 'Njc4MDkzNjY4NzcwNTEyOTE3.XkdyyA.6n4wvPmzOw-fwuysEoTPU8Cv2x0' });
|
||||
|
||||
manager.spawn();
|
||||
manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));
|
||||
DEPRICATED
|
||||
|
57
package.json
57
package.json
@@ -1,26 +1,35 @@
|
||||
{
|
||||
"name": "osselbot",
|
||||
"version": "1.1.0",
|
||||
"description": "Discordbot on Discord.js",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"discord.js": "^12.1.1",
|
||||
"n": "^6.4.0",
|
||||
"pretty-ms": "^6.0.1"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node ./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"
|
||||
"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": "npm install; 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"
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"token" : "Njc4MDkzNjY4NzcwNTEyOTE3.Xr7SNw.XS_D_dEJ7hX6N5Rmnfr_OQpfznU",
|
||||
"prefix" : ";"
|
||||
"prefix" : "?"
|
||||
}
|
||||
|
57
src/index.js
Normal file → Executable file
57
src/index.js
Normal file → Executable file
@@ -5,22 +5,30 @@ const prettyMilliseconds = require('pretty-ms');
|
||||
const config = require("./config.json");
|
||||
// This is the client
|
||||
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".
|
||||
client.user.setActivity(`${client.users.cache.size} of you horrible people`,{ type: 'LISTENING' });
|
||||
activity();
|
||||
});
|
||||
//Updates people count
|
||||
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' });
|
||||
activity();
|
||||
});
|
||||
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' });
|
||||
activity();
|
||||
});
|
||||
|
||||
setInterval(activity, 300000);
|
||||
|
||||
////// ACTUAL MESSAGE PROCESSING
|
||||
client.on("message", async message => {
|
||||
//stops bots from activating the Osselbot
|
||||
@@ -54,13 +62,14 @@ client.on("message", async message => {
|
||||
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}\
|
||||
`);
|
||||
**People:** ${client.users.cache.size}`)
|
||||
.setFooter("osselbot v2.1.0 run version for full info");
|
||||
return message.channel.send(embed);
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -113,6 +122,39 @@ client.on("message", async message => {
|
||||
};
|
||||
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)) ){
|
||||
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 === "version") {
|
||||
return message.channel.send("``` ________________________________________\n \
|
||||
< @technicolor-creamsicle/osselbot@2.1.0 >\n \
|
||||
----------------------------------------\n \
|
||||
\\ ^__^\n \
|
||||
\\ (oo)\\_______\n \
|
||||
(__)\\ )\\/\\\n \
|
||||
||----w |\n \
|
||||
|| ||\n \
|
||||
```")
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////DEFCON//////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -152,5 +194,10 @@ client.on("message", async message => {
|
||||
};
|
||||
});
|
||||
|
||||
if(process.argv.slice(2).includes("--TEST")) {
|
||||
console.log("Test Pass!");
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
//Logging in the bot
|
||||
client.login(config.token)
|
||||
|
Reference in New Issue
Block a user