-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
43 lines (36 loc) · 1.08 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//モジュールの読み込み
var keys = require('./modules/keys.js');
// ---------- discord ----------
const Discord = require('discord.js');
const client = new Discord.Client();
//botのログイン処理
client.login(keys.discord);
//botの準備ができたら呼ばれる
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
console.log(client);
});
client.on('message', msg => {
//コマンド系の場合
if(msg.content.startsWith('/xiv')){
commandCont(msg);
}
//安否確認
if(msg.content.startsWith('/xiv ping')){
msg.channel.send('hello!!');
}
});
//コマンドをさばくメソッド
function commandCont(msg){
if (msg.content.startsWith('/xiv tts')){
//ttsコマンドをスマホからでもできるように代行する
tts(msg);
}
}
function tts(msg){
//スペースで分割
var content = msg.content.slice(4);
var op={tts:true};
var cu = client.user;
msg.channel.send(msg.author.username+ 'のメッセージを代行します、' + content,op).then(message => message.delete());
}