Guest User

Discord-Bot

a guest
Dec 31st, 2022
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.26 KB | None | 0 0
  1. const { TOKEN } = require('../Arkansas-Utilities/config.json')
  2. const { MessageActionRow, ApplicationCommandOptionType, CommandInteraction, MessageButton } = require('discord.js')
  3.  
  4. const PREFIX = '-';
  5.  
  6. const Discord = require('discord.js');
  7.  
  8. const client = new Discord.Client({intents: ['GUILDS', 'GUILD_MEMBERS', 'GUILD_MESSAGES', 'MESSAGE_CONTENT', 'GUILD_MESSAGE_REACTIONS', 'GUILD_VOICE_STATES'] });
  9. const guild = client.guilds.cache.get("1058088182861791282")
  10.  
  11. client.on('messageCreate', async (msg) => {
  12. console.log(msg.content);
  13. if (!msg.content.startsWith(PREFIX)) return;
  14.  
  15. const args = msg.content.slice(PREFIX.length).split(/ +/)
  16. const command = args.shift().toLowerCase();
  17.  
  18. if (command === 'ping') {
  19. const apiping = client.ws.ping
  20. const embed = new Discord.MessageEmbed()
  21. .setColor('GREEN')
  22. .setTitle('PONG! :ping_pong:')
  23. .setDescription(`Bot Latency: **${apiping}ms**`)
  24. .setTimestamp()
  25. .setFooter(`Arkansas Utilities`)
  26.  
  27. msg.reply({ embeds: [embed] })
  28. }
  29.  
  30. if (command === 'general') {
  31.  
  32. const embed = new Discord.MessageEmbed()
  33. .setColor('GREEN')
  34. .setTitle(`General Support`)
  35. .setDescription(`Welcome to your General Support ticket, ${msg.author}!
  36. Please fill out the format below.
  37.  
  38. \ Username:
  39. Reason:\
  40.  
  41. `)
  42. .setFooter('General Support')
  43. .setTimestamp()
  44. // Create a new channel for the ticket
  45. msg.guild.channels.create(`${msg.author.username}-general`, { type: 'text' })
  46. .then(channel => {
  47. // Send a message to the channel
  48. channel.send(`<@${msg.author.id}>`)
  49. channel.send({ embeds: [embed] });
  50. })
  51. .catch(console.error);
  52. msg.delete()
  53. }
  54.  
  55. if (command === 'internalaffairs') {
  56. const embed = new Discord.MessageEmbed()
  57. .setColor('RED')
  58. .setTitle(`Internal Affairs Support`)
  59. .setDescription(`Welcome to your Internal Affairs Support ticket, ${msg.author}!
  60. Please fill out the format below.
  61.  
  62. \ Your Username:
  63. Staff Username:
  64. Reason:
  65. Proof: (Optional)\
  66.  
  67. `)
  68. .setFooter('Internal Affairs Support')
  69. .setTimestamp()
  70. // Create a new channel for the ticket
  71. msg.guild.channels.create(`${msg.author.username}-ia`, { type: 'text' })
  72. .then(channel => {
  73. // Send a message to the channel
  74. channel.send(`<@${msg.author.id}>`)
  75. channel.send({ embeds: [embed] });
  76. })
  77. .catch(console.error);
  78. msg.delete()
  79. }
  80.  
  81. if (command === 'partnership') {
  82. const embed = new Discord.MessageEmbed()
  83. .setColor('YELLOW')
  84. .setTitle(`Internal Affairs Support`)
  85. .setDescription(`Welcome to your Partnership Support ticket, ${msg.author}!
  86. Please fill out the format below.
  87.  
  88. \ Server Name:
  89. Member Count: (Without Bots)
  90. Bot Count:
  91. Reason:\
  92.  
  93. `)
  94. .setFooter('Partnership Support')
  95. .setTimestamp()
  96. // Create a new channel for the ticket
  97. msg.guild.channels.create(`${msg.author.username}-partnership`, { type: 'text' })
  98. .then(channel => {
  99. // Send a message to the channel
  100. channel.send(`<@${msg.author.id}>`)
  101. channel.send({ embeds: [embed] });
  102. })
  103. .catch(console.error);
  104. msg.delete()
  105. }
  106.  
  107. if (command === 'close') {
  108. if (!msg.member.permissions.has('MANAGE_CHANNELS')) return;
  109. msg.channel.delete()
  110. }
  111.  
  112. if (command === 'ad') {
  113. msg.channel.send(
  114. '```:grandcanyon: __Grand Canyon Roleplay__ :grandcanyon:\n*Welcome to Grand Canyon Roleplay! We are one of the new professional ER:LC servers looking for members. We have it all ;)*\n\n***__What Do we offer?__***\n\n:hammer: -- Professional & Fun Staff\n:clock3: -- Daily SSU\n:man: -- Fun & Realistic Roleplays\n:tada: -- Giveaways\n\n***__Staff Applications__***\n\n:detective: -- Fun & Easy Application\n:clock1: -- Quick And Fast\n:bar_chart: -- 10% Change You Get Denied If You Read Our Rules\n\n**__Apply Now!__**\n\n*Join Us Today At* discord.gg/gK9MEGpxMt```'
  115. )
  116. msg.delete()
  117. }
  118.  
  119. if (command === 'emit') {
  120. const welcomeChannelId = {
  121. '1058088182861791282': '1058088182861791284'
  122. }
  123. const guild = client.guilds.cache.get("1058088182861791282")
  124. let member = msg.mentions.members.first();
  125. member.guild.channels.cache.get(welcomeChannelId[member.guild.id]).send(`:wave: Welcome ${member} to **${guild}**! We are now at **${guild.memberCount} members**. Thank you for joining!`)
  126. const addRole = member.guild.roles.cache.get('1058187823703916604')
  127. member.roles.add(addRole)
  128. }
  129.  
  130. if (command === 'pingbotowner') {
  131. msg.channel.send('<@1021959500665737338> is the bot owner!')
  132. }
  133.  
  134. if (command === 'membercount') {
  135. msg.reply(`There are **${msg.guild.memberCount} members** in this server!`)
  136. }
  137.  
  138. if (command === 'poll') {
  139. msg.react('✅');
  140. msg.react('❎');
  141. }
  142.  
  143. if (command === 'warn') {
  144. if (!msg.member.permissions.has('MANAGE_ROLES')) return;
  145. let member = msg.mentions.members.first();
  146. let role = msg.mentions.roles.first();
  147. if (!member) return msg.reply("⛔️ You have to mention a member!");
  148. if (!role) return msg.reply("⛔️ You have to mention a warning number!");
  149.  
  150. member.roles.add(role);
  151. msg.channel.send(`✅ ${member} has been warned!`)
  152. }
  153.  
  154. if (command === 'role') {
  155. if (!msg.member.permissions.has('MANAGE_ROLES')) return;
  156. let member = msg.mentions.members.first();
  157. let role = msg.mentions.roles.first();
  158. if (!member) return msg.reply("⛔️ You have to mention a member!");
  159. if (!role) return msg.reply("⛔️ You have to mention a role");
  160.  
  161. member.roles.add(role);
  162. msg.channel.send(`✅ ${role} has been given to ${member}!`)
  163. }
  164.  
  165. if (command === 'remrole') {
  166. if (!msg.member.permissions.has('MANAGE_ROLES')) return;
  167. let member = msg.mentions.members.first();
  168. let role = msg.mentions.roles.first();
  169. if (!member) return msg.reply("⛔️ You have to mention a member!");
  170. if (!role) return msg.reply("⛔️ You have to mention a role");
  171.  
  172. member.roles.remove(role);
  173. msg.channel.send(`✅ ${role} has been removed from ${member}!`)
  174. }
  175.  
  176. if (command === 'remwarn') {
  177. if (!msg.member.permissions.has('MANAGE_ROLES')) return;
  178. let member = msg.mentions.members.first();
  179. let role = msg.mentions.roles.first();
  180. if (!member) return msg.reply("⛔️ You have to mention a member!");
  181. if (!role) return msg.reply("⛔️ You have to mention warning number!");
  182.  
  183. member.roles.remove(role);
  184. msg.channel.send(`✅ ${role} has been removed from ${member}!`)
  185. }
  186.  
  187. if (command === 'beg') {
  188. msg.reply('Joe came and shot you then he left.')
  189. }
  190.  
  191. if (command === 'say') {
  192. msg.delete()
  193. msg.channel.send(args.join(' '));
  194. }
  195.  
  196. if (command === `kick`) {
  197. if (!args[0]) return msg.reply("⛔️ You need to mention someone to kick!")
  198. let member = msg.mentions.members.first() || msg.guild.members.cache.get(args[0]) || msg.guild.members.cache.find(x => x.user.username.toLowerCase() === args.slice(0).join(" ") || x.user.username === args[0]);
  199. if (!msg.member.permissions.has("KICK_MEMBERS")) return msg.reply("⛔️ You do not have permission to kick members!");
  200. if (!msg.guild.me.permissions.has("KICK_MEMBERS")) return msg.reply("⛔️ I don't have permission to kick members!");
  201. if (msg.member.id === member.id) return msg.reply("⛔️ You can't kick yourself!");
  202.  
  203. member.kick()
  204. msg.channel.send(`✅ ${member} was successfully kicked!`)
  205. }
  206.  
  207. if (command === `ban`) {
  208. if (!args[0]) return msg.reply("⛔️ You need to mention someone to ban!")
  209. let member = msg.mentions.members.first() || msg.guild.members.cache.get(args[0]) || msg.guild.members.cache.find(x => x.user.username.toLowerCase() === args.slice(0).join(" ") || x.user.username === args[0]);
  210. if (!msg.member.permissions.has("BAN_MEMBERS")) return msg.reply("⛔️ You do not have permission to ban members!");
  211. if (!msg.guild.me.permissions.has("BAN_MEMBERS")) return msg.reply("⛔️ I do not have permission to ban members!");
  212. if (msg.member.id === member.id) return msg.reply("⛔️ You can't ban yourself!");
  213.  
  214. let reason = args.slice(1).join(" ") || "No reason"
  215.  
  216. member.ban({ reason:reason })
  217. msg.channel.send(`✅ ${member} was successfully banned!\nReason: ${reason}`)
  218. }
  219.  
  220. client.on('ready', () => {
  221. console.log(`Logged in as ${client.user.tag} and in ${client.guilds.cache.size} servers!`)
  222.  
  223. const guild = client.guilds.cache.get("1058088182861791282")
  224. const servers = client.guilds.cache.size
  225. const servercount = client.guilds.cache.reduce((a,b) => a+b.memberCount, 0)
  226.  
  227. const activities = [
  228. `Grand Canyon Roleplay`,
  229. `.gg/JkTzShuNfN -- Watching ${servercount} Users!`
  230. ]
  231.  
  232. setInterval(()=>{
  233. const status = activities[Math.floor(Math.random()*activities.length)]
  234. client.user.setPresence({ activities: [{ name: `${status}` }], status: 'dnd'})
  235. }, 5000)
  236.  
  237. const data = [
  238. {
  239. name: 'ping',
  240. description: 'Shows the ping of the bot!'
  241. },
  242. {
  243. name: 'membercount',
  244. description: 'The amount of members in the server!'
  245. },
  246. {
  247. name: 'beg',
  248. description: 'Beg someone for money!',
  249. options: [{
  250. name: 'who',
  251. description: 'who do you want to beg',
  252. type: 'STRING',
  253. required: true
  254. }]
  255. },
  256. {
  257. name: 'pingbotmanager',
  258. description: 'Pings the bot manager!'
  259. },
  260. {
  261. name: "kick",
  262. description: "Kicks a member from your server",
  263. options:[{
  264. name: "user",
  265. description: "The user to kick",
  266. type: "USER",
  267. required: true
  268. }, {
  269. name: "reason",
  270. description: "The reason for the kick",
  271. type: "STRING"
  272. }]
  273. },
  274. {
  275. name: "ban",
  276. description: "Bans a member from your server",
  277. options:[{
  278. name: "user",
  279. description: "The user to ban",
  280. type: "USER",
  281. required: true
  282. }, {
  283. name: "reason",
  284. description: "The reason for the ban",
  285. type: "STRING"
  286. }]
  287. },
  288. {
  289. name: 'ssu',
  290. description: 'Start an SSU'
  291. },
  292. {
  293. name: 'ssd',
  294. description: 'End the SSU'
  295. },
  296. {
  297. name: 'hello',
  298. description: 'Hello'
  299. },
  300. {
  301. name: 'moneyadd',
  302. description: 'Give someone money',
  303. options:[{
  304. name: "member",
  305. description: "The user to give money",
  306. type: "STRING",
  307. required: true
  308. }]
  309. },
  310. {
  311. name: 'invite',
  312. description: 'Invite someone to play with you.',
  313. options: [{
  314. name: 'member',
  315. description: "Ping th member you want to invite",
  316. type: 'USER',
  317. required: true
  318. }, {
  319. name: 'game',
  320. description: 'What game do you want to play',
  321. type: 'STRING',
  322. required: true
  323. }]
  324. },
  325. {
  326. name: 'loa',
  327. description: 'Go on LoA to Leave of Absense',
  328. options: [{
  329. name: 'duration',
  330. description: 'The amount of time you would like to go on LoA',
  331. type: 'STRING',
  332. required: true
  333. }, {
  334. name: 'reason',
  335. description: 'The reason you want to go on LoA',
  336. type: 'STRING',
  337. required: true
  338. }]
  339. }
  340. ]
  341.  
  342. guild.commands?.set(data)
  343.  
  344. })
  345.  
  346. client.on('interactionCreate', async (inter) => {
  347. if (inter.isButton()) return;
  348. if (inter.commandName === 'ping') {
  349. const apiping = client.ws.ping
  350. const embed = new Discord.MessageEmbed()
  351. .setColor('GREEN')
  352. .setTitle('PONG! :ping_pong:')
  353. .setDescription(`Bot Latency: **${apiping}ms**`)
  354. .setTimestamp()
  355. .setFooter(`Arkansas Utilities`)
  356.  
  357. inter.reply({ embeds: [embed] })
  358. }
  359.  
  360. const logChannelId = {
  361. '1058088182861791282': '1058149796612943892'
  362. }
  363.  
  364. const ssussdChannelId = {
  365. '1058088182861791282': '1058143101576818759'
  366. }
  367.  
  368. const banrequestChannelId = {
  369. '1058088182861791282': '1058178225156657182'
  370. }
  371.  
  372. const loaChannelId = {
  373. '1058088182861791282': '1058177594530472016'
  374. }
  375.  
  376. if (inter.commandName === 'membercount') {
  377. const embed = new Discord.MessageEmbed()
  378. .setColor('GREEN')
  379. .setTitle('Membercount')
  380. .setDescription(`There are **${inter.guild.memberCount} members** in this server!`)
  381. .setTimestamp()
  382. .setFooter(`${inter.guild.memberCount} Members`)
  383.  
  384. inter.reply({ embeds: [embed] })
  385. }
  386.  
  387.  
  388. if (inter.commandName === 'beg') {
  389. const whobeg = inter.options.getString('who')
  390. inter.reply(`${whobeg} came and shot you then he left.`)
  391. }
  392.  
  393. if (inter.commandName === 'pingbotmanager') {
  394. inter.reply(`<@1040838414121050213> is the bot manager!`)
  395. }
  396.  
  397. if (inter.commandName === 'kick') {
  398. if (!inter.member.permissions.has("KICK_MEMBERS")) return
  399. const member = inter.options.getMember('user');
  400. const reason = inter.options.getString('reason') || "No reason given";
  401. const embed = {
  402. title: "You have been kicked from " + inter.guild.name,
  403. description: "Reason: " + reason,
  404. color: "RED"
  405. }
  406.  
  407. const embed2 = {
  408. title: "Success",
  409. description: `Kicked ${member} from ${inter.guild.name}`,
  410. color: "GREEN"
  411. }
  412.  
  413. const embed3 = {
  414. title: 'Kick',
  415. description: `${member} was kicked from ${inter.guild.name}. Reason: ${reason}`,
  416. color: 'GREEN'
  417. }
  418.  
  419. inter.guild.channels.cache.get(logChannelId[member.guild.id]).send({ embeds: [embed3] })
  420.  
  421. member.send({ embeds: [embed] }).catch(() => null)
  422. inter.reply({ embeds: [embed2] });
  423.  
  424. await member.kick(reason).catch(() => null);
  425. }
  426.  
  427. if (inter.commandName === 'ban') {
  428. if (!inter.member.permissions.has("BAN_MEMBERS")) return
  429. const member = inter.options.getMember('user');
  430. const reason = inter.options.getString('reason') || "No reason given";
  431. const embed = {
  432. title: "You have been banned from " + inter.guild.name,
  433. description: "Reason: " + reason,
  434. color: "RED"
  435. }
  436.  
  437. const embed2 = {
  438. title: "Success",
  439. description: `Banned ${member} from ${inter.guild.name}`,
  440. color: "GREEN"
  441. }
  442.  
  443. const embed3 = {
  444. title: 'Ban',
  445. description: `${member} was banned from ${inter.guild.name}. Reason: ${reason}`,
  446. color: 'GREEN'
  447. }
  448.  
  449. inter.guild.channels.cache.get(logChannelId[member.guild.id]).send({ embeds: [embed3] })
  450.  
  451. member.send({ embeds: [embed] }).catch(() => null)
  452. inter.reply({ embeds: [embed2] });
  453.  
  454. await member.ban({ reason: reason }).catch(() => null)
  455. }
  456.  
  457. if (inter.commandName === 'ssu') {
  458. const ssuembed = {
  459. title: 'SSU',
  460. description: `The server is now active.
  461.  
  462. You can join now. If you have any issues or questions, feel free to open a ticket in <#1058141449788608632>
  463.  
  464. Server Name: Grand Canyon Roleplay | Strict | Professional
  465. Server Code: ***Coming Soon***
  466. Server Owner: AlphaMinedime#8578
  467.  
  468. Game link: https://www.roblox.com/games/2534724415/Emergency-Response-Liberty-County`,
  469. color: 'GREEN'
  470. }
  471.  
  472. inter.guild.channels.cache.get(ssussdChannelId[inter.guild.id]).send(`@here / <@&1058380440894984272>`)
  473. inter.guild.channels.cache.get(ssussdChannelId[inter.guild.id]).send({ embeds: [ssuembed] })
  474. inter.reply({content: `SSU started!`, ephemeral: true })
  475. }
  476.  
  477. if (inter.commandName === 'ssd') {
  478.  
  479. const ssdembed = {
  480. title: 'SSD',
  481. description: `The server has now Shut Down! Thanks for joining us!
  482.  
  483. Do not re-join until the next SSU. If you have any issues or questions, feel free to open a ticket in <#1058141449788608632>`,
  484. color: 'RED'
  485. }
  486.  
  487. inter.guild.channels.cache.get(ssussdChannelId[inter.guild.id]).send({ embeds: [ssdembed] })
  488. inter.reply({content: `Successfully ended the SSU`, ephemeral: true })
  489. }
  490.  
  491. if (inter.commandName === 'hello') {
  492. inter.reply(`Hi`)
  493. }
  494.  
  495. if (inter.commandName === 'moneyadd') {
  496. const money = inter.options.getString('member')
  497. inter.reply(`Couldn't give money to ${money} because I am broke myself! XD`)
  498. }
  499.  
  500. if (inter.commandName === 'invite') {
  501. const member = inter.options.get('member')
  502. const game = inter.options.getString('game')
  503.  
  504. inter.reply(`Hey ${member.user} , ${inter.user} is inviting you to play **${game}** with them!`)
  505. }
  506.  
  507. if (inter.commandName === 'loa') {
  508. const duration = inter.options.getString('duration')
  509. const reason = inter.options.getString(`reason`)
  510.  
  511. const embed = new Discord.MessageEmbed()
  512. .setColor(`ORANGE`)
  513. .setTitle(`LoA Request`)
  514. .setDescription(`User: ${inter.user}
  515. Duration: **${duration}**
  516. Reason: **${reason}**`)
  517. .setFooter(`${inter.user.tag}`)
  518. .setTimestamp()
  519.  
  520. inter.guild.channels.cache.get(loaChannelId[inter.guild.id]).send({ embeds: [embed] })
  521. inter.reply({ content: `Successfully requested an LoA for **${duration}** with the reason of **${reason}**`, ephemeral: true })
  522.  
  523. }
  524. })
  525.  
  526. client.on('guildMemberAdd', (member) => {
  527. const welcomeChannelId = {
  528. '1058088182861791282': '1058088182861791284'
  529. }
  530. try {
  531. const guild = client.guilds.cache.get("1058088182861791282")
  532. member.guild.channels.cache.get(welcomeChannelId[member.guild.id]).send(`:wave: Welcome ${member} to **${guild}**! We are now at **${guild.memberCount} members**. Thank you for joining!`)
  533. const MemberRoleAdd = member.guild.roles.cache.get('1058187823703916604')
  534. member.roles.add(MemberRoleAdd)
  535. } catch (error) {
  536. console.error(error)
  537. }
  538. })
  539. })
  540.  
  541. client.login(TOKEN)
  542.  
Advertisement
Add Comment
Please, Sign In to add comment