Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { Client, RichEmbed } = require("discord.js");
- const { config } = require("dotenv");
- const client = new Client({
- disableEveryone: true
- })
- config({
- path: __dirname + "/.env"
- })
- client.on("ready", () => {
- console.log(`Hi, ${client.user.username} is now online!`);
- client.user.setPresence({
- status: "dnd",
- game: {
- name: "デート・ア・ライブ",
- type: "WATCHING"
- }
- });
- })
- client.on("message", async message => {
- const prefix = "$";
- // If the author's a bot, return
- // If the message was not sent in a server, return
- // If the message doesn't start with the prefix, return
- if (message.author.bot) return;
- if (!message.guild) return;
- if (!message.content.startsWith(prefix)) return;
- // Arguments and command variable
- // cmd is the first word in the message, aka the command
- // args is an array of words after the command
- // !say hello I am a bot
- // cmd == say (because the prefix is sliced off)
- // args == ["hello", "I", "am", "a", "bot"]
- const args = message.content.slice(prefix.length).trim().split(/ +/g);
- const cmd = args.shift().toLowerCase();
- if (cmd === "ping") {
- // Send a message
- const msg = await message.channel.send(`🏓 Pinging....`);
- // Edit the message
- msg.edit(`🏓 Pong!\nLatency is ${Math.floor(msg.createdAt - message.createdAt)}ms\nAPI Latency is ${Math.round(client.ping)}ms`);
- }
- if (cmd === "say") {
- // Check if you can delete the message
- if (message.deletable) message.delete();
- if (args.length < 0) return message.reply(`Nothing to say?`).then(m => m.delete(5000));
- // Role color
- const roleColor = message.guild.me.highestRole.hexColor;
- // If the first argument is embed, send an embed,
- // otherwise, send a normal message
- if (args[0].toLowerCase() === "embed") {
- const embed = new RichEmbed()
- .setDescription(args.slice(1).join(" "))
- .setColor(roleColor === "#000000" ? "#ffffff" : roleColorv)
- .setTimestamp()
- .setImage(client.user.displayAvatarURL)
- .setAuthor(message.author.username, message.author.displayAvatarURL);
- message.channel.send(embed);
- } else {
- message.channel.send(args.join(" "));
- }
- }
- });
- client.on('message',message=>{
- if (message.content === "Where is Tohka?"){
- message.reply('Hello my dear <3');
- }
- })
- client.on('message',message=>{
- if (message.content === "Hey Tohka!" & message.author.bot)
- message.channel.send('Hey Lilli whats up?');
- if (message.content === "Not much, what about you?" & message.author.bot){
- message.channel.send('Watching Date A Live with <@271279004336521227>, btw I wanted to ask you something. In what language were you made and who made you?');
- }
- })
- client.login(process.env.TOKEN);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement