Skip to content

Commit

Permalink
Update 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Adivise committed Dec 8, 2022
1 parent e5e837a commit 88b9289
Show file tree
Hide file tree
Showing 24 changed files with 87 additions and 295 deletions.
9 changes: 0 additions & 9 deletions .env.example

This file was deleted.

2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: [Adivise]
ko_fi: nanotect
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Apache License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

Expand Down
87 changes: 42 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,60 @@
## 📑 Short Feature
- [x] Request Song
- [x] Check Current Skin Equip
- [x] See Current Nowplaying
- [x] Check PerfermancePoint When FullCombo
- [x] Easy to use!
<p align="center">
<img src="https://capsule-render.vercel.app/api?type=waving&color=gradient&height=200&section=header&text=SpacePlay&fontSize=80&fontAlignY=35&animation=twinkling&fontColor=gradient"/> </a>
</p>

<p align="center">
<a href="https://discord.gg/SNG3dh3MbR" target="_blank"> <img src="https://discordapp.com/api/guilds/903043706410643496/widget.png?style=banner2"/> </a>
</p>

## 🚨 Have a Problem
<p align="center">
<a href="https://ko-fi.com/nanotect" target="_blank"> <img src="https://ko-fi.com/img/githubbutton_sm.svg"/> </a>
</p>

✈ Join Discord: [NanoSpace ♪♪](https://discord.gg/SNG3dh3MbR)
mention me in chat #general or #javascript and ask problem okay! 👌
## 📑 Feature
- [x] Get Nowplaying
- [x] Lightweight
- [x] Easy to use!

## 📎 Requirements

1. Node.js v16+ **[Download](https://nodejs.org/en/download/)**
2. TMI Oauth **[Click Here](https://twitchapps.com/tmi/)**
3. Gosumemory **[Download](https://github.com/l3lackShark/gosumemory)**
4. Osu IRC **[Click Here](https://osu.ppy.sh/p/irc)**
- [x] Node.js **[Download](https://nodejs.org/en/download/)**
- [x] TMI Oauth **[Click Here](https://twitchapps.com/tmi/)**

## 📚 Installation

```
git clone https://github.com/Adivise/Osus
cd Osus
git clone https://github.com/Adivise/SpacePlay
cd SpacePlay
npm install
```

After installation finishes you can use `node .` to start the bot. or `Run Start.bat`
After installation finishes you can use `node .` to start the bot.

## 📄 Configuration

Copy or Rename `.env.example` to `.env` and fill out the values:

```.env
# Bot
PREFIX=!
# Twitch https://twitchapps.com/tmi/
CHANNEL=nanotect_
USERNAME=adivise
OAUTH=oauth:123456789
# Osu! https://osu.ppy.sh/p/irc
OSU_NAME=prilz
OSU_PASS=dfasdfadf
Copy or Rename `config.json.example` to `config.json` and fill out the values:

- [ ] Don't forget to run `injector/https.exe` to bot work!

```.json
{
"apiKey": "YOUR_API_KEY",
"twitch": {
"connection": {
"reconnect": true,
"secure": true
},
"identity": {
"username": "Nanotect_",
"password": "YOUR_TMI_OAUTH"
},
"channels": ["nanotect_"]
}
}
```

## 🔩 Features & Commands

> Note: The default prefix is '!'
> Your can settings all in Folder `Settings`
> Optional: [] | Required: ()
💫 **General Commands!**
- `!request (link)` - Request Song
- `!skin` - Check Current SKin
- `!ppfc` - Check PerfermancePoint When FullCombo
- `!nowplaying` - Check Nowplaying
## ❣ Contributors

## 📝 Credits
Developed by [Adivise](https://github.com/Adivise)
<a href="https://github.com/Adivise/SpaceTime/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=Adivise/SpacePlay" />
</a>
8 changes: 0 additions & 8 deletions Start.bat

This file was deleted.

35 changes: 0 additions & 35 deletions commands/general/nowplaying.js

This file was deleted.

27 changes: 0 additions & 27 deletions commands/general/ppfc.js

This file was deleted.

15 changes: 0 additions & 15 deletions commands/general/request.js

This file was deleted.

17 changes: 0 additions & 17 deletions commands/general/skin.js

This file was deleted.

14 changes: 14 additions & 0 deletions config.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"apiKey": "YOUR_API_KEY",
"twitch": {
"connection": {
"reconnect": true,
"secure": true
},
"identity": {
"username": "Nanotect_",
"password": "YOUR_TMI_OAUTH"
},
"channels": ["nanotect_"]
}
}
26 changes: 0 additions & 26 deletions events/client/message.js

This file was deleted.

17 changes: 0 additions & 17 deletions handlers/loadBancho.js

This file was deleted.

14 changes: 0 additions & 14 deletions handlers/loadCommands.js

This file was deleted.

14 changes: 0 additions & 14 deletions handlers/loadEvents.js

This file was deleted.

52 changes: 17 additions & 35 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,26 @@
const tmi = require("tmi.js");
const { Collection } = require("@discordjs/collection");
const config = require("./settings/config.js");
const { I18n } = require("locale-parser");
const { BanchoClient } = require("bancho.js");

let options = {
connection: {
reconnect: true,
secure: true
},
identity: {
username: config.USERNAME,
password: config.OAUTH,
},
channels: [config.CHANNEL],
};
const fetch = require("node-fetch");

process.on('unhandledRejection', error => console.log(error));
process.on('uncaughtException', error => console.log(error));

const client = new tmi.client(options);

client.config = require("./settings/config.js");
client.owner = config.OWNER;
client.i18n = new I18n(config.LANGUAGE);

const bancho = new BanchoClient({ username: config.OSU_NAME, password: config.OSU_PASS });

client.bancho = bancho;
const client = new tmi.client(require("./config.json").twitch);

/// Load Twitch Package
["aliases", "commands"].forEach(x => client[x] = new Collection());
["loadCommands", "loadEvents", "loadBancho"].forEach(x => require(`./handlers/${x}`)(client));

/// Start Bancho Client
bancho.connect().then(() => {
console.log("[INFO] Connected to Bancho!");
});

/// Start Twitch Client
client.connect().then(() => {
console.log("[INFO] Connected to Twitch!");

client.on("message", async (channel, tags, message, self) => {
const prefix = "!"
if (!message.startsWith(prefix)) return;
const args = message.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();

if (command == "np" || command == "nowplaying") {
const response = await fetch(`http://127.0.0.1:24050/playing`).then(res => res.json());
client.say(channel, `@${tags.username}, Beatmap: https://osu.ppy.sh/beatmapsets/${response.menu.bm.set}#/${response.menu.bm.id} | Mods: ${response.menu.mods.str}`);
} else if (command == "skin") {
const response = await fetch(`http://127.0.0.1:24050/playing`).then(res => res.json());
client.say(channel, `@${tags.username}, Skin: ${response.settings.folders.skin}`);
}
});
});
Loading

0 comments on commit 88b9289

Please sign in to comment.