Improve VC leave handling, host now lets you get the current session host, swapped skip/sticker alias, updated xm plugin
This commit is contained in:
parent
e8337c40f4
commit
3392c3c89e
6 changed files with 64 additions and 37 deletions
|
@ -25,7 +25,7 @@ class StickerCommand extends Command {
|
|||
}
|
||||
|
||||
static description = "Gets a raw sticker image";
|
||||
static aliases = ["s", "stick"];
|
||||
static aliases = ["stick"];
|
||||
static arguments = ["[sticker]"];
|
||||
}
|
||||
|
||||
|
|
|
@ -8,45 +8,48 @@ class HostCommand extends MusicCommand {
|
|||
if (!this.channel.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
|
||||
if (this.connection.host !== this.author.id && !process.env.OWNER.split(",").includes(this.connection.host)) return "Only the current voice session host can choose another host!";
|
||||
const input = this.options.user ?? this.args.join(" ");
|
||||
if (!input || !input.trim()) return "You need to provide who you want the host to be!";
|
||||
let user;
|
||||
if (this.type === "classic") {
|
||||
const getUser = this.message.mentions.length >= 1 ? this.message.mentions[0] : (await this.ipc.fetchUser(input));
|
||||
if (getUser) {
|
||||
user = getUser;
|
||||
} else if (input.match(/^<?[@#]?[&!]?\d+>?$/) && input >= 21154535154122752n) {
|
||||
try {
|
||||
user = await this.client.getRESTUser(input);
|
||||
} catch {
|
||||
// no-op
|
||||
if (input?.trim()) {
|
||||
let user;
|
||||
if (this.type === "classic") {
|
||||
const getUser = this.message.mentions.length >= 1 ? this.message.mentions[0] : (await this.ipc.fetchUser(input));
|
||||
if (getUser) {
|
||||
user = getUser;
|
||||
} else if (input.match(/^<?[@#]?[&!]?\d+>?$/) && input >= 21154535154122752n) {
|
||||
try {
|
||||
user = await this.client.getRESTUser(input);
|
||||
} catch {
|
||||
// no-op
|
||||
}
|
||||
} else {
|
||||
const userRegex = new RegExp(input.split(" ").join("|"), "i");
|
||||
const member = this.client.users.find(element => {
|
||||
return userRegex.test(element.username);
|
||||
});
|
||||
user = member;
|
||||
}
|
||||
} else {
|
||||
const userRegex = new RegExp(input.split(" ").join("|"), "i");
|
||||
const member = this.client.users.find(element => {
|
||||
return userRegex.test(element.username);
|
||||
});
|
||||
user = member;
|
||||
user = input;
|
||||
}
|
||||
if (!user) return "I can't find that user!";
|
||||
if (user.bot) return "This is illegal, you know.";
|
||||
const member = this.channel.guild ? this.channel.guild.members.get(user.id) : undefined;
|
||||
if (!member) return "That user isn't in this server!";
|
||||
const object = this.connection;
|
||||
object.host = member.id;
|
||||
players.set(this.channel.guild.id, object);
|
||||
return `🔊 ${member.mention} is the new voice channel host.`;
|
||||
} else {
|
||||
user = input;
|
||||
const member = this.channel.guild ? this.channel.guild.members.get(players.get(this.channel.guild.id).host) : undefined;
|
||||
return `🔊 The current voice channel host is **${member?.username}#${member?.discriminator}**.`;
|
||||
}
|
||||
if (!user) return "I can't find that user!";
|
||||
if (user.bot) return "Setting a bot as the session host isn't a very good idea.";
|
||||
const member = this.channel.guild ? this.channel.guild.members.get(user.id) : undefined;
|
||||
if (!member) return "That user isn't in this server!";
|
||||
const object = this.connection;
|
||||
object.host = member.id;
|
||||
players.set(this.channel.guild.id, object);
|
||||
return `🔊 ${member.mention} is the new voice channel host.`;
|
||||
}
|
||||
|
||||
static flags = [{
|
||||
name: "user",
|
||||
type: 6,
|
||||
description: "The user you want the new host to be",
|
||||
required: true
|
||||
description: "The user you want the new host to be"
|
||||
}];
|
||||
static description = "Changes the host of the current voice session";
|
||||
static description = "Gets or changes the host of the current voice session";
|
||||
static aliases = ["sethost"];
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class SkipCommand extends MusicCommand {
|
|||
}
|
||||
|
||||
static description = "Skips the current song";
|
||||
static aliases = ["forceskip"];
|
||||
static aliases = ["forceskip", "s"];
|
||||
}
|
||||
|
||||
export default SkipCommand;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue