@@ -32,6 +32,7 @@ public BaseTrigger(TriggerType type, string name, TriggerOptionsBase options)
3232 else if ( options . NoCommand != null ) OptionsType = OptionType . NoCommand ;
3333 else if ( options . TriggerLists != null && options . TriggerNumbers != null ) OptionsType = OptionType . ListsAndNumbers ;
3434 else if ( options . TriggerLists != null ) OptionsType = OptionType . JustLists ;
35+ else if ( options . NoteTriggerOptions != null ) OptionsType = OptionType . NoteTriggerOptions ;
3536
3637 Type = type ;
3738 Name = name ;
@@ -75,7 +76,8 @@ public void SaveTrigger()
7576 TriggerLists = Options . TriggerLists ,
7677 TriggerNumbers = Options . TriggerNumbers ,
7778 AntiSpamTriggerOptions = Options . AntiSpamTriggerOptions ,
78- DiscordOptions = Options . DiscordOptions
79+ DiscordOptions = Options . DiscordOptions ,
80+ NoteTriggerOptions = Options . NoteTriggerOptions
7981 } ;
8082 string json = JsonConvert . SerializeObject ( options , Formatting . Indented ) ;
8183 File . WriteAllText ( Bot . username + "/triggers/" + Name + ".json" , json ) ;
@@ -155,6 +157,9 @@ public static List<BaseTrigger> ReadTriggers()
155157 case TriggerType . ModerateChatTrigger :
156158 temp . Add ( new ModerateChatTrigger ( type , name , options ) ) ;
157159 break ;
160+ case TriggerType . NoteTrigger :
161+ temp . Add ( new NoteTrigger ( type , name , options ) ) ;
162+ break ;
158163 case TriggerType . PlayGameTrigger :
159164 temp . Add ( new PlayGameTrigger ( type , name , options ) ) ;
160165 break ;
@@ -754,9 +759,12 @@ protected void SendMessageAfterDelay(SteamID steamID, string message, bool room)
754759 case OptionType . DiscordTrigger :
755760 delay = Options . DiscordOptions . NoCommand . TriggerNumbers . Delay == null ? 0 : Options . DiscordOptions . NoCommand . TriggerNumbers . Delay . Value ;
756761 break ;
762+ case OptionType . NoteTriggerOptions :
763+ delay = Options . NoteTriggerOptions . NoCommand . TriggerNumbers . Delay == null ? 0 : Options . NoteTriggerOptions . NoCommand . TriggerNumbers . Delay . Value ;
764+ break ;
757765 }
758766 }
759- catch ( NullReferenceException nfe ) { }
767+ catch ( NullReferenceException nre ) { }
760768 catch ( Exception e )
761769 {
762770 Log . Instance . Error ( "{0}/{1}: {2}" , Bot . username , Name , e . StackTrace ) ;
@@ -849,9 +857,12 @@ protected bool CheckIgnores(SteamID toID, SteamID fromID)
849857 case OptionType . DiscordTrigger :
850858 ignore = Options . DiscordOptions . NoCommand . TriggerLists . Ignore ;
851859 break ;
860+ case OptionType . NoteTriggerOptions :
861+ ignore = Options . NoteTriggerOptions . NoCommand . TriggerLists . Ignore ;
862+ break ;
852863 }
853864 }
854- catch ( NullReferenceException nfe ) { }
865+ catch ( NullReferenceException nre ) { }
855866 catch ( Exception e )
856867 {
857868 Log . Instance . Error ( "{0}/{1}: {2}" , Bot . username , Name , e . StackTrace ) ;
@@ -909,9 +920,12 @@ protected bool CheckRoom(SteamID toID)
909920 case OptionType . DiscordTrigger :
910921 rooms = Options . DiscordOptions . NoCommand . TriggerLists . Rooms ;
911922 break ;
923+ case OptionType . NoteTriggerOptions :
924+ rooms = Options . NoteTriggerOptions . NoCommand . TriggerLists . Rooms ;
925+ break ;
912926 }
913927 }
914- catch ( NullReferenceException nfe ) { }
928+ catch ( NullReferenceException nre ) { }
915929 catch ( Exception e )
916930 {
917931 Log . Instance . Error ( "{0}/{1}: {2}" , Bot . username , Name , e . StackTrace ) ;
@@ -971,9 +985,12 @@ protected bool CheckUser(SteamID fromID)
971985 case OptionType . DiscordTrigger :
972986 users = Options . DiscordOptions . NoCommand . TriggerLists . User ;
973987 break ;
988+ case OptionType . NoteTriggerOptions :
989+ users = Options . NoteTriggerOptions . NoCommand . TriggerLists . User ;
990+ break ;
974991 }
975992 }
976- catch ( NullReferenceException nfe ) { }
993+ catch ( NullReferenceException nre ) { }
977994 catch ( Exception e )
978995 {
979996 Log . Instance . Error ( "{0}/{1}: {2}" , Bot . username , Name , e . StackTrace ) ;
@@ -1026,10 +1043,13 @@ protected bool RandomRoll()
10261043 case OptionType . DiscordTrigger :
10271044 prob = Options . DiscordOptions . NoCommand . TriggerNumbers . Probability == null ? 1 : Options . DiscordOptions . NoCommand . TriggerNumbers . Probability . Value ;
10281045 break ;
1046+ case OptionType . NoteTriggerOptions :
1047+ prob = Options . NoteTriggerOptions . NoCommand . TriggerNumbers . Probability == null ? 1 : Options . NoteTriggerOptions . NoCommand . TriggerNumbers . Probability . Value ;
1048+ break ;
10291049
10301050 }
10311051 }
1032- catch ( NullReferenceException nfe ) { }
1052+ catch ( NullReferenceException nre ) { }
10331053 catch ( Exception e )
10341054 {
10351055 Log . Instance . Error ( "{0}/{1}: {2}" , Bot . username , Name , e . StackTrace ) ;
@@ -1078,9 +1098,13 @@ protected void DisableForTimeout()
10781098 case OptionType . DiscordTrigger :
10791099 to = Options . DiscordOptions . NoCommand . TriggerNumbers . Timeout == null ? 0 : Options . DiscordOptions . NoCommand . TriggerNumbers . Timeout . Value ;
10801100 break ;
1101+ case OptionType . NoteTriggerOptions :
1102+ to = Options . NoteTriggerOptions . NoCommand . TriggerNumbers . Timeout == null ? 0 : Options . NoteTriggerOptions . NoCommand . TriggerNumbers . Timeout . Value ;
1103+ break ;
1104+
10811105 }
10821106 }
1083- catch ( NullReferenceException nfe ) { }
1107+ catch ( NullReferenceException nre ) { }
10841108 catch ( Exception e )
10851109 {
10861110 Log . Instance . Error ( "{0}/{1}: {2}" , Bot . username , Name , e . StackTrace ) ;
0 commit comments