-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4cb5dd
commit 99b5289
Showing
23 changed files
with
279 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,5 @@ node_modules/ | |
|
||
# log files | ||
.log | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* OwO Bot for Discord | ||
* Copyright (C) 2021 Christopher Thai | ||
* This software is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International | ||
* For more information, see README.md and LICENSE | ||
*/ | ||
|
||
const CommandInterface = require('../../CommandInterface.js'); | ||
|
||
const warnEmoji = '⚠️'; | ||
|
||
module.exports = new CommandInterface({ | ||
|
||
alias:["discordplays","twitchplays", "emulator"], | ||
|
||
args:"", | ||
|
||
desc:"", | ||
|
||
example:[], | ||
|
||
related:[], | ||
|
||
permissions:["sendMessages", "embedLinks"], | ||
|
||
group:["social"], | ||
|
||
cooldown: 10000, | ||
|
||
execute: async function (p) { | ||
let content = `${warnEmoji} **|** This is still a work in progress. The emulator will reset once everything goes live` | ||
+ `\n${p.config.emoji.blank} **|** AGAIN, THIS COMMAND IS STILL A WORK IN PROGRESS!!` | ||
+ `\n${p.config.emoji.blank} **|** https://www.twitch.tv/owobotplays`; | ||
let components = [ | ||
{ | ||
type: 1, | ||
components: [ | ||
{ | ||
type: 2, | ||
style: 1, | ||
label: 'A', | ||
custom_id: "emulator_a" | ||
}, | ||
{ | ||
type: 2, | ||
style: 1, | ||
label: '▲', | ||
custom_id: "emulator_up", | ||
}, | ||
{ | ||
type: 2, | ||
style: 1, | ||
label: 'B', | ||
custom_id: "emulator_b" | ||
}, | ||
{ | ||
type: 2, | ||
style: 1, | ||
label: 'START', | ||
custom_id: "emulator_start" | ||
} | ||
] | ||
}, | ||
{ | ||
type: 1, | ||
components: [ | ||
{ | ||
type: 2, | ||
style: 1, | ||
label: '◄', | ||
custom_id: "emulator_left" | ||
}, | ||
{ | ||
type: 2, | ||
style: 1, | ||
label: '▼', | ||
custom_id: "emulator_down" | ||
}, | ||
{ | ||
type: 2, | ||
style: 1, | ||
label: '►', | ||
custom_id: "emulator_right" | ||
}, | ||
{ | ||
type: 2, | ||
style: 1, | ||
label: 'SELECT', | ||
custom_id: "emulator_select" | ||
} | ||
] | ||
} | ||
]; | ||
|
||
await p.send({content, components}); | ||
|
||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* OwO Bot for Discord | ||
* Copyright (C) 2021 Christopher Thai | ||
* This software is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International | ||
* For more information, see README.md and LICENSE | ||
*/ | ||
|
||
exports.handle = async function (data, ack) { | ||
await this.socketio.streamEmit(data.member.user, 'a'); | ||
await ack(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* OwO Bot for Discord | ||
* Copyright (C) 2021 Christopher Thai | ||
* This software is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International | ||
* For more information, see README.md and LICENSE | ||
*/ | ||
|
||
exports.handle = async function (data, ack) { | ||
await this.socketio.streamEmit(data.member.user, 'b'); | ||
await ack(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* OwO Bot for Discord | ||
* Copyright (C) 2021 Christopher Thai | ||
* This software is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International | ||
* For more information, see README.md and LICENSE | ||
*/ | ||
|
||
exports.handle = async function (data, ack) { | ||
await this.socketio.streamEmit(data.member.user, 'down'); | ||
await ack(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* OwO Bot for Discord | ||
* Copyright (C) 2021 Christopher Thai | ||
* This software is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International | ||
* For more information, see README.md and LICENSE | ||
*/ | ||
|
||
exports.handle = async function (data, ack) { | ||
await this.socketio.streamEmit(data.member.user, 'left'); | ||
await ack(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* OwO Bot for Discord | ||
* Copyright (C) 2021 Christopher Thai | ||
* This software is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International | ||
* For more information, see README.md and LICENSE | ||
*/ | ||
|
||
exports.handle = async function (data, ack) { | ||
await this.socketio.streamEmit(data.member.user, 'right'); | ||
await ack(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* OwO Bot for Discord | ||
* Copyright (C) 2021 Christopher Thai | ||
* This software is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International | ||
* For more information, see README.md and LICENSE | ||
*/ | ||
|
||
exports.handle = async function (data, ack) { | ||
await this.socketio.streamEmit(data.member.user, 'select'); | ||
await ack(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* OwO Bot for Discord | ||
* Copyright (C) 2021 Christopher Thai | ||
* This software is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International | ||
* For more information, see README.md and LICENSE | ||
*/ | ||
|
||
exports.handle = async function (data, ack) { | ||
await this.socketio.streamEmit(data.member.user, 'start'); | ||
await ack(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* OwO Bot for Discord | ||
* Copyright (C) 2021 Christopher Thai | ||
* This software is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International | ||
* For more information, see README.md and LICENSE | ||
*/ | ||
|
||
exports.handle = async function (data, ack) { | ||
await this.socketio.streamEmit(data.member.user, 'up'); | ||
await ack(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* OwO Bot for Discord | ||
* Copyright (C) 2021 Christopher Thai | ||
* This software is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International | ||
* For more information, see README.md and LICENSE | ||
*/ | ||
const axios = require('axios'); | ||
const requireDir = require('require-dir'); | ||
const dir = requireDir('./'); | ||
|
||
class InteractionHandler { | ||
constructor (main) { | ||
this.listeners = {}; | ||
let filename = __filename.slice(__dirname.length + 1, -3); | ||
for (let listener in dir) { | ||
if (listener != filename) { | ||
this.listeners[listener] = dir[listener].handle.bind(main); | ||
} | ||
} | ||
} | ||
|
||
emit (name, data) { | ||
if (this.listeners[name]) { | ||
const url = `https://discord.com/api/v8/interactions/${data.id}/${data.token}/callback` | ||
const ack = () => { | ||
return axios.post(url, { type: 6 }); | ||
} | ||
this.listeners[name](data, ack); | ||
} | ||
} | ||
} | ||
|
||
module.exports = InteractionHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.