first commit
This commit is contained in:
commit
86764942d9
11 changed files with 152 additions and 0 deletions
9
src/commands/help.ts
Normal file
9
src/commands/help.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
export function returnHelpText() {
|
||||
return "# Howdy user, welcome to pluralcake\n" +
|
||||
"pluralcake is a bot that allows you to send messages as your Alters, with a custom profile picture, tag and nickname. \n" +
|
||||
"It's pretty much a work in progress, and doesn't allow you to edit or delete messages, and to send pictures." +
|
||||
"The currently available commands are : \n" +
|
||||
"- list | allows you to see your currently available alters.\n" +
|
||||
"- create <'name of the alter'> <'your alter s tag'>| Allows you to create your Alters\n" +
|
||||
"- avatar <'Alter's name'> <'picture url'> | Allows you to edit your alter's profile picture"
|
||||
}
|
3
src/commands/help.ts~
Normal file
3
src/commands/help.ts~
Normal file
|
@ -0,0 +1,3 @@
|
|||
export function returnHelpText() {
|
||||
return "gum"
|
||||
}
|
20
src/index.ts
Normal file
20
src/index.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { Client, Message } from "revolt.js";
|
||||
import { commandHandler } from "./utils/commandHandler"
|
||||
import config from "../config.json"
|
||||
const client : Client = new Client();
|
||||
|
||||
|
||||
client.on("ready", async () => {
|
||||
console.info(`Gummed in as ${client.user.username}!`)
|
||||
client.user.edit({status : {text: config.prefix + "help for the help menu"}})
|
||||
});
|
||||
|
||||
client.on("messageCreate", async (message: Message) => {
|
||||
if (message.author.bot) {}
|
||||
else {
|
||||
if (message.content.startsWith(config.prefix)){commandHandler(message, config.prefix)}
|
||||
else {}
|
||||
}
|
||||
});
|
||||
|
||||
client.loginBot(config.botKey);
|
18
src/index.ts~
Normal file
18
src/index.ts~
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { Client, Message } from "revolt.js";
|
||||
import { commandHandler } from "./utils/commandHandler"
|
||||
import config from "../config.json"
|
||||
const client : Client = new Client();
|
||||
|
||||
|
||||
client.on("ready", async () =>
|
||||
console.info(`Gummed in as ${client.user.username}!`)
|
||||
);
|
||||
|
||||
client.on("messageCreate", async (message: Message) => {
|
||||
if (message.author.bot) {}
|
||||
else {
|
||||
if (message.content.startsWith(config.prefix)){commandHandler(message, config.prefix)}
|
||||
}
|
||||
});
|
||||
|
||||
client.loginBot(config.botKey);
|
15
src/repositories/CharacterRepo.ts
Normal file
15
src/repositories/CharacterRepo.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { Database } from 'sqlite3';
|
||||
export class CharacterRepo {
|
||||
db : Database
|
||||
constructor() {
|
||||
this.db = new Database('db.sqlite');
|
||||
}
|
||||
|
||||
getAllCharacters(){
|
||||
return this.db.get(
|
||||
'SELECT * FROM CHARACTERS',
|
||||
res => console.log(res)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
13
src/services/CharacterService.ts
Normal file
13
src/services/CharacterService.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { CharacterRepo } from "repositories/CharacterRepo";
|
||||
|
||||
class CharacterService {
|
||||
repo : CharacterRepo;
|
||||
|
||||
constructor() {
|
||||
this.repo = new CharacterRepo();
|
||||
}
|
||||
|
||||
public getCharacter() : any{
|
||||
return this.repo.getAllCharacters();
|
||||
}
|
||||
}
|
23
src/utils/commandHandler.ts
Normal file
23
src/utils/commandHandler.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { Message } from "revolt.js"
|
||||
import { returnHelpText } from "../commands/help"
|
||||
import { split } from "shlex"
|
||||
|
||||
export async function commandHandler(message : Message, prefix : String) {
|
||||
let args : String[] = split(message.content);
|
||||
args.shift()
|
||||
const command = args[0]
|
||||
|
||||
switch(command) {
|
||||
case "help" : {
|
||||
message.reply(returnHelpText());
|
||||
break;
|
||||
}
|
||||
case "list" : {
|
||||
message.reply("not yet implemented")
|
||||
break;
|
||||
}
|
||||
case "create" : {
|
||||
message.reply("not yet implemented")
|
||||
}
|
||||
}
|
||||
}
|
9
src/utils/commandHandler.ts~
Normal file
9
src/utils/commandHandler.ts~
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { Message } from "revolt.js"
|
||||
|
||||
export function commandHandler(message : Message) {
|
||||
switch(message.content) {
|
||||
case "help" : {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue