mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-08 19:31:35 +02:00
Various bug fixes
This commit is contained in:
parent
15d4e251f2
commit
c058ec95fe
7 changed files with 36 additions and 35 deletions
|
@ -1,4 +1,4 @@
|
|||
import {TextChannel, Message} from 'discord.js';
|
||||
import {TextChannel, Message, GuildChannel} from 'discord.js';
|
||||
import {injectable} from 'inversify';
|
||||
import {Settings} from '../models';
|
||||
import errorMsg from '../utils/error-msg';
|
||||
|
@ -50,7 +50,13 @@ export default class implements Command {
|
|||
}
|
||||
|
||||
case 'channel': {
|
||||
const channel = msg.guild!.channels.cache.find(c => c.name === args[1]);
|
||||
let channel: GuildChannel | undefined;
|
||||
|
||||
if (args[1].includes('<#') && args[1].includes('>')) {
|
||||
channel = msg.guild!.channels.cache.find(c => c.id === args[1].slice(2, args[1].indexOf('>')));
|
||||
} else {
|
||||
channel = msg.guild!.channels.cache.find(c => c.name === args[1]);
|
||||
}
|
||||
|
||||
if (channel && channel.type === 'text') {
|
||||
await Settings.update({channel: channel.id}, {where: {guildId: msg.guild!.id}});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue