more fixes

This commit is contained in:
Skillz
2020-09-16 12:47:13 -04:00
parent f07636338c
commit 21385804af
7 changed files with 23 additions and 12 deletions

View File

@@ -68,7 +68,7 @@ Client({
},
messageCreate: (message) => {
if (message.content === "!ping") {
sendMessage(message.channel, "Pong");
sendMessage(message.channelID, "Pong");
}
}
}

View File

@@ -101,7 +101,7 @@ nekosEndpoints.forEach((endpoint) => {
execute: async function (message) {
const url = `https://nekos.life/api/v2${endpoint.path}`;
const result = await fetch(url).then((res) => res.json());
sendMessage(message.channel, result?.url);
sendMessage(message.channelID, result?.url);
},
});
});
@@ -124,7 +124,7 @@ nekosEndpoints.forEach((endpoint) => {
execute: async function (message) {
const url = `https://nekos.life/api/v2${endpoint.path}`;
const result = await fetch(url).then((res) => res.json());
sendMessage(message.channel, result?.url);
sendMessage(message.channelID, result?.url);
},
});
});
@@ -142,7 +142,7 @@ botCache.commands.set(endpoint.name, {
execute: async function (message) {
const url = `https://nekos.life/api/v2${endpoint.path}`;
const result = await fetch(url).then((res) => res.json());
sendMessage(message.channel, result?.url);
sendMessage(message.channelID, result?.url);
},
});
```

View File

@@ -40,7 +40,7 @@ botCache.commands.set("prefix", {
`)
.setTimestamp();
sendEmbed(message.channel, embed);
sendEmbed(message.channelID, embed);
},
});
@@ -74,7 +74,7 @@ createSubcommand("prefix", {
`)
.setTimestamp();
sendEmbed(message.channel, embed);
sendEmbed(message.channelID, embed);
},
});
```
@@ -102,7 +102,7 @@ botCache.commands.set("prefix", {
`)
.setTimestamp();
sendEmbed(message.channel, embed);
sendEmbed(message.channelID, embed);
},
});
```
@@ -140,7 +140,7 @@ createSubcommand("prefix", {
`)
.setTimestamp();
sendEmbed(message.channel, embed);
sendEmbed(message.channelID, embed);
},
});
```
@@ -221,4 +221,4 @@ createSubcommand("settings-feedback", {
---
**THE POWER AND MAGIC OF DISCORDENO AT YOUR FINGERTIPS!**
**THE POWER AND MAGIC OF DISCORDENO AT YOUR FINGERTIPS!**

View File

@@ -60,7 +60,7 @@ Client({
},
messageCreate: (message) => {
if (message.content === "!ping") {
sendMessage(message.channel, "Pong");
sendMessage(message.channelID, "Pong");
}
}
}

View File

@@ -20,7 +20,7 @@ botCache.commands.set("invite", {
execute: function (message) {
// Replace the permission number at the end to request the permissions you wish to request. By default, this will request Admin perms.
sendMessage(
message.channel,
message.channelID,
`https://discordapp.com/oauth2/authorize?client_id=${botID}&scope=bot&permissions=8`,
);
},
@@ -586,7 +586,7 @@ funCommandData.forEach((data) => {
)
.setImage(chooseRandom(data.gifs));
return sendEmbed(message.channel, embed);
return sendEmbed(message.channelID, embed);
},
});

1
mod.ts
View File

@@ -2,6 +2,7 @@ import createClient from "./src/module/client.ts";
export * from "./src/controllers/mod.ts";
export * from "./src/controllers/bans.ts";
export * from "./src/controllers/cache.ts";
export * from "./src/controllers/channels.ts";
export * from "./src/controllers/guilds.ts";
export * from "./src/controllers/members.ts";

View File

@@ -80,15 +80,25 @@ function forEach(
}
export let cacheHandlers = {
/** Deletes all items from the cache */
clear: async function (table: TableName) {
return cache[table].clear();
},
/** Deletes 1 item from cache using the key */
delete: async function (table: TableName, key: string) {
return cache[table].delete(key);
},
/** Check if something exists in cache with a key */
has: async function (table: TableName, key: string) {
return cache[table].has(key);
},
// Done differently to have overloads
/** Add a key value pair to the cache */
set,
/** Get the value from the cache using its key */
get,
/** Run a function on all items in this cache */
forEach,
};