renesansz / discord-greeter-bot

My greeter bot for Discord
MIT License
49 stars 38 forks source link

How would I make the Bot join my voice channel? #67

Closed isherzad closed 5 years ago

isherzad commented 6 years ago

var Discord = require("discord.io"); var logger = require("winston"); var auth = require("./auth.json");

// Configure logger settings

logger.remove(logger.transports.Console); logger.add(logger.transports.Console, { colorize: true }); logger.level = "debug";

//initialize alpha-bot var bot = new Discord.Client({ token: auth.token, autorun: true });

//shows bot status in the console bot.on("ready", function (evt) { logger.info("Connected"); logger.info("Logged in as: "); logger.info(bot.username + " - (" + bot.id + ")"); });

bot.on("message", function (user, userID, channelID, message, evt, Member, client, VoiceChannels) { //bots presence: bot.setPresence({ game:{ name: "Serving the Pack" } }); //Bot needs to know when to execute a command //listens to messages starting with if (message.substring(0, 1) == "") { var args = message.substring(1).split(" "); var cmd = args[0];

  args = args.splice(1);
  switch(cmd) {
      // *ping
      case "ping":
          bot.sendMessage({
              to: channelID,
              message: "Pong"
          });
      //join voice
      case "join":
          bot.joinVoiceChannel(channelID, function(error, events){});
      break;
      //case commands here
  }   

} });

This is my current code, but the join command won't work

Thanks in advance

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.