mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
voice fixes
This commit is contained in:
38
test/msgbot.js
Normal file
38
test/msgbot.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/* global describe */
|
||||
/* global process */
|
||||
|
||||
var Discord = require("../");
|
||||
var client = new Discord.Client();
|
||||
var request = require("request");
|
||||
|
||||
client.on("ready", () => {
|
||||
console.log("ready");
|
||||
});
|
||||
|
||||
client.on("message", msg => {
|
||||
|
||||
if(!msg.sender.equals(client.user))
|
||||
console.log("received message from " + msg.sender.username);
|
||||
|
||||
if (msg.content === "$bind") {
|
||||
msg.channel.server.channels.get("type", "voice").join();
|
||||
}
|
||||
|
||||
if (msg.content.startsWith("$play")) {
|
||||
var url = msg.content.split(" ")[1];
|
||||
|
||||
client.voiceConnection.playRawStream(request(url));
|
||||
|
||||
}
|
||||
|
||||
if (msg.content === "$$$") {
|
||||
client.sendMessage(msg.sender, "hi!");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
console.log("INIT");
|
||||
|
||||
client.on("debug", console.log)
|
||||
|
||||
client.login(process.env["ds_email"], process.env["ds_password"]).catch(console.log);
|
||||
Reference in New Issue
Block a user