Skip to content

Commit 351bcd3

Browse files
committed
event handling
1 parent 2687bd0 commit 351bcd3

30 files changed

+229
-172
lines changed

Diff for: .gitignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# OS or Editor folders
2+
._*
3+
.cache
4+
.idea
5+
.project
6+
.settings
7+
.tmproj
8+
*.esproj
9+
*.sublime-project
10+
*.sublime-workspace
11+
nbproject
12+
Thumbs.db
13+
ehthumbs.db
14+
.DS_Store
15+
.DS_Store?
16+
.Spotlight-V100
17+
.Trashes
18+
*.swp
19+
._*
20+
.env
21+
/node_modules
22+
/.vscode

Diff for: commands/8.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require("dotenv").config();
12
const { SlashCommandBuilder } = require("discord.js");
23
const wait = require("node:timers/promises").setTimeout;
34

@@ -16,7 +17,7 @@ module.exports = {
1617

1718
async execute(interaction) {
1819
const { client } = interaction;
19-
let botOwner = client.users.cache.get("410839910204047360").tag;
20+
let botOwner = client.users.cache.get(process.env.OWNERID).tag;
2021
var answers = [
2122
"It is certain.",
2223
"It is decidedly so.",
@@ -58,7 +59,7 @@ module.exports = {
5859
value: randomAnswer,
5960
},
6061
],
61-
timestamp: new Date(),
62+
timestamp: new Date().toISOString(),
6263
footer: {
6364
text: `Made with ❤️ created by ${botOwner}`,
6465
},

Diff for: commands/about.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require("dotenv").config();
12
const { SlashCommandBuilder } = require("discord.js");
23

34
module.exports = {
@@ -6,7 +7,7 @@ module.exports = {
67
.setDescription("Shows you the info about the bot!"),
78
async execute(interaction) {
89
const { client } = interaction;
9-
const botOwner = client.users.cache.get("410839910204047360").tag;
10+
const botOwner = client.users.cache.get(process.env.OWNERID).tag;
1011
interaction.reply({
1112
embeds: [
1213
{
@@ -19,7 +20,7 @@ module.exports = {
1920
fields: [
2021
{
2122
name: "Bot Version",
22-
value: "hackerman14 (Beta)",
23+
value: "hackerman14",
2324
},
2425
{
2526
name: "Bot Since",
@@ -47,7 +48,7 @@ module.exports = {
4748
value: "[Discord.js](https://discord.js.org/)",
4849
},
4950
],
50-
timestamp: new Date(),
51+
timestamp: new Date().toISOString(),
5152
footer: {
5253
text: `Made with ❤️ created by ${botOwner}`,
5354
},

Diff for: commands/ban.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
const { SlashCommandBuilder } = require("discord.js");
2-
const { PermissionFlagsBits } = require("discord.js");
1+
require("dotenv").config();
2+
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
33
const wait = require("node:timers/promises").setTimeout;
44

55
module.exports = {
66
data: new SlashCommandBuilder()
77
.setName("ban")
88
.setDescription("Fake bans people!")
99
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
10+
.setDMPermission(false)
1011
.addUserOption((option) =>
1112
option
1213
.setName("user")

Diff for: commands/changelog.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require("dotenv").config();
12
const { SlashCommandBuilder } = require("discord.js");
23

34
module.exports = {
@@ -6,14 +7,14 @@ module.exports = {
67
.setDescription("Check what changes are made to the bot!"),
78
async execute(interaction) {
89
const { client } = interaction;
9-
const botOwner = client.users.cache.get("410839910204047360").tag;
10+
const botOwner = client.users.cache.get(process.env.OWNERID).tag;
1011
await interaction.reply({
1112
embeds: [
1213
{
1314
color: 0x0ccab6,
1415
title: "**Bot Changelog**",
1516
description: "Date: July 20, 2022",
16-
timestamp: new Date(),
17+
timestamp: new Date().toISOString(),
1718
fields: [
1819
{
1920
name: "discord.js v14!",
@@ -37,7 +38,7 @@ module.exports = {
3738
color: 0x0ccab6,
3839
title: "**Previous Bot Changelog**",
3940
description: "Date: May 21, 2022",
40-
timestamp: new Date(),
41+
timestamp: new Date().toISOString(),
4142
fields: [
4243
{
4344
name: "New command",

Diff for: commands/covid.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
const fetch = require("node-fetch");
1+
require("dotenv").config();
22
const { SlashCommandBuilder } = require("discord.js");
3+
const fetch = require("node-fetch");
34

45
module.exports = {
56
data: new SlashCommandBuilder()
67
.setName("covid")
78
.setDescription("Tells you summary details of COVID-19 information!"),
89
async execute(interaction) {
910
const { client } = interaction;
10-
const botOwner = client.users.cache.get("410839910204047360").tag;
11+
const botOwner = client.users.cache.get(process.env.OWNERID).tag;
1112
fetch("https://api.covid19api.com/summary")
1213
.then((res) => res.json())
1314
.then((body) => {
@@ -35,7 +36,7 @@ module.exports = {
3536
value: body.Global.TotalDeaths.toString(),
3637
},
3738
],
38-
timestamp: new Date(),
39+
timestamp: new Date().toISOString(),
3940
footer: {
4041
text: `Made with ❤️ created by ${botOwner}`,
4142
},

Diff for: commands/discordtips.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require("dotenv").config();
12
const { SlashCommandBuilder } = require("discord.js");
23

34
module.exports = {
@@ -8,7 +9,7 @@ module.exports = {
89
),
910
async execute(interaction) {
1011
const { client } = interaction;
11-
const botOwner = client.users.cache.get("410839910204047360").tag;
12+
const botOwner = client.users.cache.get(process.env.OWNERID).tag;
1213
var tips = [
1314
"Discord's official birthday is May 13, 2015.",
1415
"`CTRL` `K` / `CMD` `K` to quickly find a previous conversation or channel.",
@@ -44,7 +45,7 @@ module.exports = {
4445
color: 0x0ccab6,
4546
title: "**Discord Tips**",
4647
description: randomTip,
47-
timestamp: new Date(),
48+
timestamp: new Date().toISOString(),
4849
footer: {
4950
text: `Made with ❤️ created by ${botOwner}`,
5051
},

Diff for: commands/example.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require("dotenv").config();
12
const { SlashCommandBuilder } = require("discord.js");
23

34
module.exports = {
@@ -48,7 +49,7 @@ module.exports = {
4849
image: {
4950
url: "https://i.imgur.com/wSTFkRM.png",
5051
},
51-
timestamp: new Date(),
52+
timestamp: new Date().toISOString(),
5253
footer: {
5354
text: "Some footer text here",
5455
icon_url: "https://i.imgur.com/wSTFkRM.png",

Diff for: commands/fact.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
const fetch = require("node-fetch");
1+
require("dotenv").config();
22
const { SlashCommandBuilder } = require("discord.js");
3+
const fetch = require("node-fetch");
34

45
module.exports = {
56
data: new SlashCommandBuilder()
67
.setName("fact")
78
.setDescription("Tells you a boring fact!"),
89
async execute(interaction) {
910
const { client } = interaction;
10-
const botOwner = client.users.cache.get("410839910204047360").tag;
11+
const botOwner = client.users.cache.get(process.env.OWNERID).tag;
1112
fetch("https://useless-facts.sameerkumar.website/api")
1213
.then((res) => res.json())
1314
.then((body) => {

Diff for: commands/feedback.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require("dotenv").config();
12
const {
23
MessageActionRow,
34
MessageSelectMenu,

Diff for: commands/fuckoff.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
const { ActionRowBuilder, ButtonBuilder } = require("discord.js");
2-
const { SlashCommandBuilder } = require("discord.js");
1+
require("dotenv").config();
2+
const { SlashCommandBuilder, PermissionFlagsBits, ActionRowBuilder, ButtonBuilder } = require("discord.js");
33

44
module.exports = {
55
data: new SlashCommandBuilder()
66
.setName("fuckoff")
7-
.setDescription("A fancy way to kick this bot! >:("),
7+
.setDescription("A fancy way to kick this bot! >:(")
8+
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers)
9+
.setDMPermission(false),
810
async execute(interaction) {
911
const { client, guild } = interaction;
10-
const botOwner = client.users.cache.get("410839910204047360").tag;
12+
const botOwner = client.users.cache.get(process.env.OWNERID).tag;
1113
const cancelAction = new ActionRowBuilder().addComponents(
1214
new ButtonBuilder()
1315
.setCustomId("cancel")
@@ -21,7 +23,7 @@ module.exports = {
2123
color: "#db574f",
2224
title: "**You Hate Me™**",
2325
description: "Only the moderators can perform this action!",
24-
timestamp: new Date(),
26+
timestamp: new Date().toISOString(),
2527
footer: {
2628
text: `Made with ❤️ created by ${botOwner}`,
2729
},
@@ -36,7 +38,7 @@ module.exports = {
3638
title: "**You Hate Me™**",
3739
description:
3840
"Sorry to see you go, the bot will leave within 60 seconds after executing the command.\n**To cancel the action, click on the button below.**",
39-
timestamp: new Date(),
41+
timestamp: new Date().toISOString(),
4042
footer: {
4143
text: `Made with ❤️ created by ${botOwner}`,
4244
},
@@ -58,7 +60,7 @@ module.exports = {
5860
color: 0x0ccab6,
5961
title: "**You Hate Me™**",
6062
description: "Action cancelled!",
61-
timestamp: new Date(),
63+
timestamp: new Date().toISOString(),
6264
footer: {
6365
text: `Made with ❤️ created by ${botOwner}`,
6466
},
@@ -81,7 +83,7 @@ module.exports = {
8183
title: "**You Hate Me™**",
8284
description:
8385
"Thank you for using hackerman14 bot, have a nice day!",
84-
timestamp: new Date(),
86+
timestamp: new Date().toISOString(),
8587
footer: {
8688
text: `Made with ❤️ created by ${botOwner}`,
8789
},

Diff for: commands/gif.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
const fetch = require("node-fetch");
1+
require("dotenv").config();
22
const { SlashCommandBuilder } = require("discord.js");
3+
const fetch = require("node-fetch");
34

45
module.exports = {
56
data: new SlashCommandBuilder()
67
.setName("gif")
78
.setDescription("Sends you a random GIF!"),
89
async execute(interaction) {
910
const { client } = interaction;
10-
const botOwner = client.users.cache.get("410839910204047360").tag;
11+
const botOwner = client.users.cache.get(process.env.OWNERID).tag;
1112
fetch(`http://api.giphy.com/v1/gifs/random?api_key=${process.env.GIPHY}&rating=g`)
1213
.then((res) => res.json())
1314
.then((body) => {
@@ -17,7 +18,7 @@ module.exports = {
1718
color: 0x0ccab6,
1819
title: "**Random GIF**",
1920
description: "Here's your GIF!",
20-
timestamp: new Date(),
21+
timestamp: new Date().toISOString(),
2122
image: {
2223
url: body.data.images.original.url,
2324
},

0 commit comments

Comments
 (0)