updated
This commit is contained in:
@@ -42,12 +42,12 @@ async function getChannel(interaction) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return interaction.editReply({
|
return interaction.editReply({
|
||||||
content: `#${res.channel} previously set for Event: ${event}`,
|
content: `<#${res.channel}> was previously set for Event: ${event}`,
|
||||||
flags: MessageFlags.Ephemeral
|
flags: MessageFlags.Ephemeral
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return interaction.editReply({
|
return interaction.editReply({
|
||||||
content: `**[ERROR]:** There was an error updating the database: ${error}`,
|
content: `**[ERROR]:** ${event} is currently not set to any channel`,
|
||||||
flags: MessageFlags.Ephemeral
|
flags: MessageFlags.Ephemeral
|
||||||
}).then(setTimeout(() => {
|
}).then(setTimeout(() => {
|
||||||
interaction.deleteReply()
|
interaction.deleteReply()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { SlashCommandBuilder, Events, MessageFlags } = require('discord.js')
|
const { SlashCommandBuilder, MessageFlags } = require('discord.js')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -13,11 +13,10 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const streamer = 'x__hel__x'
|
const streamer = 'x__hel__x'
|
||||||
interaction.client.emit('TwitchLive', streamer)
|
interaction.client.emit('Twitch/Live', streamer)
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: "Done!",
|
content: "Done!",
|
||||||
flags: MessageFlags.Ephemeral
|
flags: MessageFlags.Ephemeral
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
const { Events } = require('discord.js')
|
||||||
|
const { createCanvas, loadImage } = require('canvas')
|
||||||
|
const path = require('node:path')
|
||||||
|
const { dClient, mClient } = require('../..')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: Events.GuildMemberAdd,
|
||||||
|
once: false,
|
||||||
|
async execute(member) {
|
||||||
|
const db = mClient.db('guilds')
|
||||||
|
const coll = db.collection(member.guild.id)
|
||||||
|
const res = await coll.findOne({ event: 'GuildMemberAdd'})
|
||||||
|
|
||||||
|
const guild = dClient.guilds.cache.get(member.guild.id)
|
||||||
|
const channel = guild.channels.cache.get(res.channel)
|
||||||
|
//const logs = guild.channels.cache.get(logID)
|
||||||
|
//logs.send(`${member.user.username} joined the Server`)
|
||||||
|
|
||||||
|
const canvas = new createCanvas(700, 250)
|
||||||
|
const ctx = canvas.getContext('2d')
|
||||||
|
const background = await loadImage(
|
||||||
|
path.join(__dirname, '../../assets/background.png')
|
||||||
|
)
|
||||||
|
|
||||||
|
let x = background.width / 2 * -1
|
||||||
|
let y = background.height / 5 * -1
|
||||||
|
ctx.drawImage(background, x, y)
|
||||||
|
|
||||||
|
const pfp = await loadImage(
|
||||||
|
member.user.displayAvatarURL({
|
||||||
|
extension: 'jpg',
|
||||||
|
size: 64
|
||||||
|
}))
|
||||||
|
|
||||||
|
x = canvas.width / 2 - pfp.width / 2
|
||||||
|
y = 25
|
||||||
|
ctx.drawImage(pfp, x, y)
|
||||||
|
|
||||||
|
ctx.fillStyle = '#ffffff'
|
||||||
|
ctx.strokeStyle = '#000000'
|
||||||
|
ctx.font = '35px sans-serif'
|
||||||
|
let text = `Welcome, ${member.user.username}`
|
||||||
|
x = canvas.width / 2 - ctx.measureText(text).width / 2
|
||||||
|
ctx.fillText(text, x, 60 + pfp.height)
|
||||||
|
ctx.strokeText(text, x, 60 + pfp.height)
|
||||||
|
|
||||||
|
ctx.font = '30px sans-serif'
|
||||||
|
text = `to Helcord!`
|
||||||
|
x = canvas.width / 2 - ctx.measureText(text).width / 2
|
||||||
|
ctx.fillText(text, x, 100 + pfp.height)
|
||||||
|
ctx.strokeText(text, x, 100 + pfp.height)
|
||||||
|
|
||||||
|
|
||||||
|
channel.send({
|
||||||
|
files: [{
|
||||||
|
attachment: canvas.toBuffer(),
|
||||||
|
name: 'banner.png',
|
||||||
|
description: 'a welcome banner'
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,8 +16,7 @@ module.exports = {
|
|||||||
// tClient.say(channel, `!so ${user}`); // Send the shoutout command
|
// tClient.say(channel, `!so ${user}`); // Send the shoutout command
|
||||||
|
|
||||||
// Use custom shoutout
|
// Use custom shoutout
|
||||||
let channelID = await getIDByName(user)
|
let res = await getChannelInformation(user)
|
||||||
let res = await getChannelInformation(channelID)
|
|
||||||
let channelInfo = res?.data[0]
|
let channelInfo = res?.data[0]
|
||||||
let shoutoutMessage = `Check out ${channelInfo.broadcaster_name} over at https://twitch.tv/${channelInfo.broadcaster_login}! They were last playing ${channelInfo.game_name}`
|
let shoutoutMessage = `Check out ${channelInfo.broadcaster_name} over at https://twitch.tv/${channelInfo.broadcaster_login}! They were last playing ${channelInfo.game_name}`
|
||||||
tClient.say(channel, shoutoutMessage)
|
tClient.say(channel, shoutoutMessage)
|
||||||
|
|||||||
+2
-1
@@ -156,7 +156,8 @@ async function updateChatMode(broadcaster_id, setTo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get channel information
|
// Get channel information
|
||||||
async function getChannelInformation(broadcaster_id) {
|
async function getChannelInformation(streamer) {
|
||||||
|
const broadcaster_id = await getIDByName(streamer)
|
||||||
return await makeHelixRequest('GET', 'channels', { broadcaster_id });
|
return await makeHelixRequest('GET', 'channels', { broadcaster_id });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user