This commit is contained in:
Master Kwoth 2016-02-08 10:58:36 +01:00
parent 6c80f36ecd
commit 7dc0fe6dd0
4 changed files with 41 additions and 27 deletions

View File

@ -452,6 +452,20 @@ namespace NadekoBot.Modules {
await client.CurrentUser.Edit(NadekoBot.password, e.GetArg("new_name"));
});
cgb.CreateCommand(".newavatar")
.Alias(".setavatar")
.Description("Sets the new avatar from the image URL. PNG and JPEG supported")
.Parameter("new_avatar", ParameterType.Required)
.Do(async e => {
if (e.User.Id != NadekoBot.OwnerID || e.GetArg("new_avatar") == null) return;
var arg = e.GetArg("new_avatar").Trim();
ImageType imgType = ImageType.Jpeg;
if (arg.EndsWith("png"))
imgType = ImageType.Png;
var res = await Searches.GetResponseStream(e.GetArg("new_avatar"));
await client.CurrentUser.Edit(NadekoBot.password, avatar: res, avatarType: imgType);
});
cgb.CreateCommand(".setgame")
.Description("Sets the bots game.")
.Parameter("set_game", ParameterType.Unparsed)

View File

@ -26,7 +26,7 @@ namespace NadekoBot.Modules
var arg = string.IsNullOrWhiteSpace(e.GetArg("role")) ? "@everyone" : e.GetArg("role");
var role = e.Server.FindRoles(arg).FirstOrDefault();
if (role == null) {
await e.Channel.SendMessage(":anger: Role not found.");
await e.Channel.SendMessage("💢 Role not found.");
return;
}
var members = role.Members.Where(u => u.Status == Discord.UserStatus.Online); // only online

View File

@ -52,9 +52,9 @@ namespace NadekoBot.Modules {
.Do(async e => {
if (musicPlayers.ContainsKey(e.Server) == false) return;
if (musicPlayers[e.Server].TogglePause())
await e.Send(":musical_note:`Music player paused.`");
await e.Send("🎵`Music player paused.`");
else
await e.Send(":musical_note:`Music player unpaused.`");
await e.Send("🎵`Music player unpaused.`");
});
cgb.CreateCommand("q")
@ -68,11 +68,11 @@ namespace NadekoBot.Modules {
.Description("Lists up to 10 currently queued songs.")
.Do(async e => {
if (musicPlayers.ContainsKey(e.Server) == false) {
await e.Send(":musical_note: No active music player.");
await e.Send("🎵 No active music player.");
return;
}
var player = musicPlayers[e.Server];
string toSend = ":musical_note: **" + player.SongQueue.Count + "** `videos currently queued.` ";
string toSend = "🎵 **" + player.SongQueue.Count + "** `videos currently queued.` ";
if (player.SongQueue.Count >= 25)
toSend += "**Song queue is full!**\n";
await e.Send(toSend);
@ -86,7 +86,7 @@ namespace NadekoBot.Modules {
.Do(async e => {
if (musicPlayers.ContainsKey(e.Server) == false) return;
var player = musicPlayers[e.Server];
await e.Send($":musical_note:`Now Playing` {player.CurrentSong.FullPrettyName}");
await e.Send($"🎵`Now Playing` {player.CurrentSong.FullPrettyName}");
});
cgb.CreateCommand("vol")
@ -102,7 +102,7 @@ namespace NadekoBot.Modules {
return;
}
volume = player.SetVolume(volume);
await e.Send($":musical_note: `Volume set to {volume}%`");
await e.Send($"🎵 `Volume set to {volume}%`");
});
cgb.CreateCommand("min").Alias("mute")
@ -140,7 +140,7 @@ namespace NadekoBot.Modules {
}
player.SongQueue.Shuffle();
await e.Send(":musical_note: `Songs shuffled.`");
await e.Send("🎵 `Songs shuffled.`");
});
bool setgameEnabled = false;
@ -169,17 +169,17 @@ namespace NadekoBot.Modules {
.Parameter("playlist", ParameterType.Unparsed)
.Do(async e => {
if (e.User.VoiceChannel?.Server != e.Server) {
await e.Send(":anger: You need to be in the voice channel on this server.");
await e.Send("💢 You need to be in the voice channel on this server.");
return;
}
var ids = await Searches.GetVideoIDs(await Searches.GetPlaylistIdByKeyword(e.GetArg("playlist")));
//todo TEMPORARY SOLUTION, USE RESOLVE QUEUE IN THE FUTURE
var msg = await e.Send($":musical_note: Attempting to queue **{ids.Count}** songs".SnPl(ids.Count));
var msg = await e.Send($"🎵 Attempting to queue **{ids.Count}** songs".SnPl(ids.Count));
foreach (var id in ids) {
Task.Run(async () => await QueueSong(e, id, true)).ConfigureAwait(false);
await Task.Delay(150);
}
msg?.Edit(":musical_note: `Playlist queue complete.`");
msg?.Edit("🎵 `Playlist queue complete.`");
});
cgb.CreateCommand("radio").Alias("ra")
@ -187,7 +187,7 @@ namespace NadekoBot.Modules {
.Parameter("radio_link", ParameterType.Required)
.Do(async e => {
if (e.User.VoiceChannel?.Server != e.Server) {
await e.Send(":anger: You need to be in the voice channel on this server.");
await e.Send("💢 You need to be in the voice channel on this server.");
return;
}
await QueueSong(e, e.GetArg("radio_link"), radio: true);
@ -207,7 +207,7 @@ namespace NadekoBot.Modules {
private async Task QueueSong(CommandEventArgs e, string query, bool silent = false, bool radio = false) {
if (e.User.VoiceChannel?.Server != e.Server) {
await e.Send(":anger: You need to be in the voice channel on this server.");
await e.Send("💢 You need to be in the voice channel on this server.");
return;
}
if (musicPlayers.ContainsKey(e.Server) == false)
@ -231,15 +231,15 @@ namespace NadekoBot.Modules {
Message qmsg = null;
Message msg = null;
if (!silent) {
qmsg = await e.Channel.SendMessage(":musical_note: `Searching...`");
qmsg = await e.Channel.SendMessage("🎵 `Searching...`");
sr.OnResolving += async () => {
await qmsg.Edit($":musical_note: `Resolving`... \"{query}\"");
await qmsg.Edit($"🎵 `Resolving`... \"{query}\"");
};
sr.OnResolvingFailed += async (err) => {
await qmsg.Edit($":anger: :musical_note: `Resolving failed` for **{query}**");
await qmsg.Edit($"💢 🎵 `Resolving failed` for **{query}**");
};
sr.OnQueued += async () => {
await qmsg.Edit($":musical_note:`Queued`{sr.FullPrettyName}");
await qmsg.Edit($"🎵`Queued`{sr.FullPrettyName}");
};
}
sr.OnCompleted += async () => {
@ -248,10 +248,10 @@ namespace NadekoBot.Modules {
if (mc.SongQueue.Count == 0)
mc.Stop();
}
await e.Send($":musical_note:`Finished`{sr.FullPrettyName}");
await e.Send($"🎵`Finished`{sr.FullPrettyName}");
};
sr.OnStarted += async () => {
var msgTxt = $":musical_note:`Playing`{sr.FullPrettyName} `Vol: {(int)(player.Volume * 100)}%`";
var msgTxt = $"🎵`Playing`{sr.FullPrettyName} `Vol: {(int)(player.Volume * 100)}%`";
if (msg == null)
await e.Send(msgTxt);
else
@ -259,11 +259,11 @@ namespace NadekoBot.Modules {
qmsg?.Delete();
};
sr.OnBuffering += async () => {
msg = await e.Send($":musical_note:`Buffering...`{sr.FullPrettyName}");
msg = await e.Send($"🎵`Buffering...`{sr.FullPrettyName}");
};
} catch (Exception ex) {
Console.WriteLine();
await e.Send($":anger: {ex.Message}");
await e.Send($"💢 {ex.Message}");
return;
}
}

View File

@ -93,7 +93,7 @@ namespace NadekoBot.Modules {
var obj = JObject.Parse(await GetResponseAsync(reqString));
await e.Send(obj["items"][0]["link"].ToString());
} catch (Exception ex) {
await e.Send($":anger: {ex.Message}");
await e.Send($"💢 {ex.Message}");
}
});
@ -108,7 +108,7 @@ namespace NadekoBot.Modules {
var obj = JObject.Parse(await GetResponseAsync(reqString));
await e.Send(obj["items"][0]["link"].ToString());
} catch (Exception ex) {
await e.Send($":anger: {ex.Message}");
await e.Send($"💢 {ex.Message}");
}
});
@ -153,7 +153,7 @@ namespace NadekoBot.Modules {
var obj = JArray.Parse(await GetResponseAsync($"http://api.oboobs.ru/boobs/{_r.Next(0, 9304)}"))[0];
await e.Send($"http://media.oboobs.ru/{ obj["preview"].ToString() }");
} catch (Exception ex) {
await e.Send($":anger: {ex.Message}");
await e.Send($"💢 {ex.Message}");
}
});
cgb.CreateCommand("lmgtfy")
@ -171,7 +171,7 @@ namespace NadekoBot.Modules {
.Do(async e => {
var arg = e.GetArg("name");
if (string.IsNullOrWhiteSpace(arg)) {
await e.Send(":anger: Please enter a card name to search for.");
await e.Send("💢 Please enter a card name to search for.");
return;
}
await e.Channel.SendIsTyping();
@ -201,7 +201,7 @@ namespace NadekoBot.Modules {
await e.Channel.SendFile(arg + ".png", (await images.MergeAsync()).ToStream(System.Drawing.Imaging.ImageFormat.Png));
Console.WriteLine("Finish");
} catch (Exception ex) {
await e.Send($":anger: Error {ex.Message}");
await e.Send($"💢 Error {ex.Message}");
}
});
@ -224,7 +224,7 @@ namespace NadekoBot.Modules {
} catch (Exception) { }
};
} catch {
await e.Channel.SendMessage(":anger: Failed retrieving osu signature :\\");
await e.Channel.SendMessage("💢 Failed retrieving osu signature :\\");
}
}
});