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")); 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") cgb.CreateCommand(".setgame")
.Description("Sets the bots game.") .Description("Sets the bots game.")
.Parameter("set_game", ParameterType.Unparsed) .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 arg = string.IsNullOrWhiteSpace(e.GetArg("role")) ? "@everyone" : e.GetArg("role");
var role = e.Server.FindRoles(arg).FirstOrDefault(); var role = e.Server.FindRoles(arg).FirstOrDefault();
if (role == null) { if (role == null) {
await e.Channel.SendMessage(":anger: Role not found."); await e.Channel.SendMessage("💢 Role not found.");
return; return;
} }
var members = role.Members.Where(u => u.Status == Discord.UserStatus.Online); // only online 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 => { .Do(async e => {
if (musicPlayers.ContainsKey(e.Server) == false) return; if (musicPlayers.ContainsKey(e.Server) == false) return;
if (musicPlayers[e.Server].TogglePause()) if (musicPlayers[e.Server].TogglePause())
await e.Send(":musical_note:`Music player paused.`"); await e.Send("🎵`Music player paused.`");
else else
await e.Send(":musical_note:`Music player unpaused.`"); await e.Send("🎵`Music player unpaused.`");
}); });
cgb.CreateCommand("q") cgb.CreateCommand("q")
@ -68,11 +68,11 @@ namespace NadekoBot.Modules {
.Description("Lists up to 10 currently queued songs.") .Description("Lists up to 10 currently queued songs.")
.Do(async e => { .Do(async e => {
if (musicPlayers.ContainsKey(e.Server) == false) { if (musicPlayers.ContainsKey(e.Server) == false) {
await e.Send(":musical_note: No active music player."); await e.Send("🎵 No active music player.");
return; return;
} }
var player = musicPlayers[e.Server]; 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) if (player.SongQueue.Count >= 25)
toSend += "**Song queue is full!**\n"; toSend += "**Song queue is full!**\n";
await e.Send(toSend); await e.Send(toSend);
@ -86,7 +86,7 @@ namespace NadekoBot.Modules {
.Do(async e => { .Do(async e => {
if (musicPlayers.ContainsKey(e.Server) == false) return; if (musicPlayers.ContainsKey(e.Server) == false) return;
var player = musicPlayers[e.Server]; 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") cgb.CreateCommand("vol")
@ -102,7 +102,7 @@ namespace NadekoBot.Modules {
return; return;
} }
volume = player.SetVolume(volume); 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") cgb.CreateCommand("min").Alias("mute")
@ -140,7 +140,7 @@ namespace NadekoBot.Modules {
} }
player.SongQueue.Shuffle(); player.SongQueue.Shuffle();
await e.Send(":musical_note: `Songs shuffled.`"); await e.Send("🎵 `Songs shuffled.`");
}); });
bool setgameEnabled = false; bool setgameEnabled = false;
@ -169,17 +169,17 @@ namespace NadekoBot.Modules {
.Parameter("playlist", ParameterType.Unparsed) .Parameter("playlist", ParameterType.Unparsed)
.Do(async e => { .Do(async e => {
if (e.User.VoiceChannel?.Server != e.Server) { 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; return;
} }
var ids = await Searches.GetVideoIDs(await Searches.GetPlaylistIdByKeyword(e.GetArg("playlist"))); var ids = await Searches.GetVideoIDs(await Searches.GetPlaylistIdByKeyword(e.GetArg("playlist")));
//todo TEMPORARY SOLUTION, USE RESOLVE QUEUE IN THE FUTURE //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) { foreach (var id in ids) {
Task.Run(async () => await QueueSong(e, id, true)).ConfigureAwait(false); Task.Run(async () => await QueueSong(e, id, true)).ConfigureAwait(false);
await Task.Delay(150); await Task.Delay(150);
} }
msg?.Edit(":musical_note: `Playlist queue complete.`"); msg?.Edit("🎵 `Playlist queue complete.`");
}); });
cgb.CreateCommand("radio").Alias("ra") cgb.CreateCommand("radio").Alias("ra")
@ -187,7 +187,7 @@ namespace NadekoBot.Modules {
.Parameter("radio_link", ParameterType.Required) .Parameter("radio_link", ParameterType.Required)
.Do(async e => { .Do(async e => {
if (e.User.VoiceChannel?.Server != e.Server) { 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; return;
} }
await QueueSong(e, e.GetArg("radio_link"), radio: true); 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) { private async Task QueueSong(CommandEventArgs e, string query, bool silent = false, bool radio = false) {
if (e.User.VoiceChannel?.Server != e.Server) { 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; return;
} }
if (musicPlayers.ContainsKey(e.Server) == false) if (musicPlayers.ContainsKey(e.Server) == false)
@ -231,15 +231,15 @@ namespace NadekoBot.Modules {
Message qmsg = null; Message qmsg = null;
Message msg = null; Message msg = null;
if (!silent) { if (!silent) {
qmsg = await e.Channel.SendMessage(":musical_note: `Searching...`"); qmsg = await e.Channel.SendMessage("🎵 `Searching...`");
sr.OnResolving += async () => { sr.OnResolving += async () => {
await qmsg.Edit($":musical_note: `Resolving`... \"{query}\""); await qmsg.Edit($"🎵 `Resolving`... \"{query}\"");
}; };
sr.OnResolvingFailed += async (err) => { sr.OnResolvingFailed += async (err) => {
await qmsg.Edit($":anger: :musical_note: `Resolving failed` for **{query}**"); await qmsg.Edit($"💢 🎵 `Resolving failed` for **{query}**");
}; };
sr.OnQueued += async () => { sr.OnQueued += async () => {
await qmsg.Edit($":musical_note:`Queued`{sr.FullPrettyName}"); await qmsg.Edit($"🎵`Queued`{sr.FullPrettyName}");
}; };
} }
sr.OnCompleted += async () => { sr.OnCompleted += async () => {
@ -248,10 +248,10 @@ namespace NadekoBot.Modules {
if (mc.SongQueue.Count == 0) if (mc.SongQueue.Count == 0)
mc.Stop(); mc.Stop();
} }
await e.Send($":musical_note:`Finished`{sr.FullPrettyName}"); await e.Send($"🎵`Finished`{sr.FullPrettyName}");
}; };
sr.OnStarted += async () => { 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) if (msg == null)
await e.Send(msgTxt); await e.Send(msgTxt);
else else
@ -259,11 +259,11 @@ namespace NadekoBot.Modules {
qmsg?.Delete(); qmsg?.Delete();
}; };
sr.OnBuffering += async () => { sr.OnBuffering += async () => {
msg = await e.Send($":musical_note:`Buffering...`{sr.FullPrettyName}"); msg = await e.Send($"🎵`Buffering...`{sr.FullPrettyName}");
}; };
} catch (Exception ex) { } catch (Exception ex) {
Console.WriteLine(); Console.WriteLine();
await e.Send($":anger: {ex.Message}"); await e.Send($"💢 {ex.Message}");
return; return;
} }
} }

View File

@ -93,7 +93,7 @@ namespace NadekoBot.Modules {
var obj = JObject.Parse(await GetResponseAsync(reqString)); var obj = JObject.Parse(await GetResponseAsync(reqString));
await e.Send(obj["items"][0]["link"].ToString()); await e.Send(obj["items"][0]["link"].ToString());
} catch (Exception ex) { } 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)); var obj = JObject.Parse(await GetResponseAsync(reqString));
await e.Send(obj["items"][0]["link"].ToString()); await e.Send(obj["items"][0]["link"].ToString());
} catch (Exception ex) { } 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]; 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() }"); await e.Send($"http://media.oboobs.ru/{ obj["preview"].ToString() }");
} catch (Exception ex) { } catch (Exception ex) {
await e.Send($":anger: {ex.Message}"); await e.Send($"💢 {ex.Message}");
} }
}); });
cgb.CreateCommand("lmgtfy") cgb.CreateCommand("lmgtfy")
@ -171,7 +171,7 @@ namespace NadekoBot.Modules {
.Do(async e => { .Do(async e => {
var arg = e.GetArg("name"); var arg = e.GetArg("name");
if (string.IsNullOrWhiteSpace(arg)) { 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; return;
} }
await e.Channel.SendIsTyping(); 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)); await e.Channel.SendFile(arg + ".png", (await images.MergeAsync()).ToStream(System.Drawing.Imaging.ImageFormat.Png));
Console.WriteLine("Finish"); Console.WriteLine("Finish");
} catch (Exception ex) { } 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 (Exception) { }
}; };
} catch { } catch {
await e.Channel.SendMessage(":anger: Failed retrieving osu signature :\\"); await e.Channel.SendMessage("💢 Failed retrieving osu signature :\\");
} }
} }
}); });