small fixes, not adding youtube gaming because api sux, closes #25
This commit is contained in:
parent
400df43875
commit
c32b32e056
@ -10,8 +10,8 @@ using NadekoBot.Modules;
|
|||||||
namespace NadekoBot.Commands {
|
namespace NadekoBot.Commands {
|
||||||
class CrossServerTextChannel : DiscordCommand {
|
class CrossServerTextChannel : DiscordCommand {
|
||||||
public CrossServerTextChannel(DiscordModule module) : base(module) {
|
public CrossServerTextChannel(DiscordModule module) : base(module) {
|
||||||
try {
|
|
||||||
NadekoBot.Client.MessageReceived += async (s, e) => {
|
NadekoBot.Client.MessageReceived += async (s, e) => {
|
||||||
|
try {
|
||||||
if (e.Message.User.Id == NadekoBot.Creds.BotId) return;
|
if (e.Message.User.Id == NadekoBot.Creds.BotId) return;
|
||||||
foreach (var subscriber in Subscribers) {
|
foreach (var subscriber in Subscribers) {
|
||||||
var set = subscriber.Value;
|
var set = subscriber.Value;
|
||||||
@ -21,9 +21,11 @@ namespace NadekoBot.Commands {
|
|||||||
await chan.SendMessage(GetText(e.Server, e.Channel, e.User, e.Message));
|
await chan.SendMessage(GetText(e.Server, e.Channel, e.User, e.Message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch { }
|
||||||
};
|
};
|
||||||
NadekoBot.Client.MessageUpdated += async (s, e) => {
|
NadekoBot.Client.MessageUpdated += async (s, e) => {
|
||||||
if (e.After.User.Id == NadekoBot.Creds.BotId) return;
|
try {
|
||||||
|
if (e.After?.User?.Id == null || e.After.User.Id == NadekoBot.Creds.BotId) return;
|
||||||
foreach (var subscriber in Subscribers) {
|
foreach (var subscriber in Subscribers) {
|
||||||
var set = subscriber.Value;
|
var set = subscriber.Value;
|
||||||
if (!set.Contains(e.Channel))
|
if (!set.Contains(e.Channel))
|
||||||
@ -36,9 +38,9 @@ namespace NadekoBot.Commands {
|
|||||||
await msg.Edit(GetText(e.Server, e.Channel, e.User, e.After));
|
await msg.Edit(GetText(e.Server, e.Channel, e.User, e.After));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
} catch { }
|
} catch { }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetText(Server server, Channel channel, User user, Message message) =>
|
private string GetText(Server server, Channel channel, User user, Message message) =>
|
||||||
|
@ -8,6 +8,7 @@ using System.Timers;
|
|||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using NadekoBot.Classes;
|
using NadekoBot.Classes;
|
||||||
using NadekoBot.Classes.JSONModels;
|
using NadekoBot.Classes.JSONModels;
|
||||||
|
using NadekoBot.Classes.Permissions;
|
||||||
using NadekoBot.Modules;
|
using NadekoBot.Modules;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
@ -85,12 +86,14 @@ namespace NadekoBot.Commands {
|
|||||||
.Description("Notifies this channel when a certain user starts streaming." +
|
.Description("Notifies this channel when a certain user starts streaming." +
|
||||||
"\n**Usage**: ~hitbox SomeStreamer")
|
"\n**Usage**: ~hitbox SomeStreamer")
|
||||||
.Parameter("username", ParameterType.Unparsed)
|
.Parameter("username", ParameterType.Unparsed)
|
||||||
|
.AddCheck(SimpleCheckers.ManageServer())
|
||||||
.Do(TrackStream(StreamNotificationConfig.StreamType.Hitbox));
|
.Do(TrackStream(StreamNotificationConfig.StreamType.Hitbox));
|
||||||
|
|
||||||
cgb.CreateCommand(Module.Prefix + "twitch")
|
cgb.CreateCommand(Module.Prefix + "twitch")
|
||||||
.Alias(Module.Prefix + "tw")
|
.Alias(Module.Prefix + "tw")
|
||||||
.Description("Notifies this channel when a certain user starts streaming." +
|
.Description("Notifies this channel when a certain user starts streaming." +
|
||||||
"\n**Usage**: ~twitch SomeStreamer")
|
"\n**Usage**: ~twitch SomeStreamer")
|
||||||
|
.AddCheck(SimpleCheckers.ManageServer())
|
||||||
.Parameter("username", ParameterType.Unparsed)
|
.Parameter("username", ParameterType.Unparsed)
|
||||||
.Do(TrackStream(StreamNotificationConfig.StreamType.Twitch));
|
.Do(TrackStream(StreamNotificationConfig.StreamType.Twitch));
|
||||||
|
|
||||||
@ -98,6 +101,7 @@ namespace NadekoBot.Commands {
|
|||||||
.Alias(Module.Prefix + "rms")
|
.Alias(Module.Prefix + "rms")
|
||||||
.Description("Removes notifications of a certain streamer on this channel." +
|
.Description("Removes notifications of a certain streamer on this channel." +
|
||||||
"\n**Usage**: ~srm SomeGuy")
|
"\n**Usage**: ~srm SomeGuy")
|
||||||
|
.AddCheck(SimpleCheckers.ManageServer())
|
||||||
.Parameter("username", ParameterType.Unparsed)
|
.Parameter("username", ParameterType.Unparsed)
|
||||||
.Do(async e => {
|
.Do(async e => {
|
||||||
var username = e.GetArg("username")?.ToLower().Trim();
|
var username = e.GetArg("username")?.ToLower().Trim();
|
||||||
@ -155,7 +159,8 @@ namespace NadekoBot.Commands {
|
|||||||
Username = username,
|
Username = username,
|
||||||
Type = type,
|
Type = type,
|
||||||
};
|
};
|
||||||
if (NadekoBot.Config.ObservingStreams.Contains(stream)) {
|
var exists = NadekoBot.Config.ObservingStreams.Contains(stream);
|
||||||
|
if (exists) {
|
||||||
await e.Channel.SendMessage(":anger: I am already notifying that stream on this channel.");
|
await e.Channel.SendMessage(":anger: I am already notifying that stream on this channel.");
|
||||||
}
|
}
|
||||||
Tuple<bool, string> data;
|
Tuple<bool, string> data;
|
||||||
@ -174,7 +179,9 @@ namespace NadekoBot.Commands {
|
|||||||
else if (type == StreamNotificationConfig.StreamType.YoutubeGaming)
|
else if (type == StreamNotificationConfig.StreamType.YoutubeGaming)
|
||||||
msg += $"\n`Here is the Link:` not implemented yet - {stream.Username}";
|
msg += $"\n`Here is the Link:` not implemented yet - {stream.Username}";
|
||||||
stream.LastStatus = data.Item1;
|
stream.LastStatus = data.Item1;
|
||||||
await e.Channel.SendMessage($":ok: I will notify this channel when status changes.\n{msg}");
|
if (!exists)
|
||||||
|
msg = $":ok: I will notify this channel when status changes.\n{msg}";
|
||||||
|
await e.Channel.SendMessage(msg);
|
||||||
NadekoBot.Config.ObservingStreams.Add(stream);
|
NadekoBot.Config.ObservingStreams.Add(stream);
|
||||||
ConfigHandler.SaveConfig();
|
ConfigHandler.SaveConfig();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user