File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -79,18 +79,19 @@ public async Task HandleMessageOrCommand(SocketMessage s)
7979
8080 var argPos = 0 ;
8181
82- var msgStrip = ctx . Message . Content . Replace ( prefix , string . Empty ) ;
82+ var msgStrip = msg . Content . Replace ( prefix , string . Empty ) ;
83+
8384
84- foreach ( var command in config . CustomCommands )
85+ if ( msg . HasStringPrefix ( prefix , ref argPos ) || msg . HasMentionPrefix ( _client . CurrentUser , ref argPos ) )
8586 {
86- if ( msg . HasStringPrefix ( prefix + command . Key , ref argPos ) )
87+ if ( config . CustomCommands . ContainsKey ( msgStrip ) )
8788 {
88- await ctx . Channel . SendMessageAsync ( command . Value ) ;
89+ await ctx . Channel . SendMessageAsync (
90+ config . CustomCommands . FirstOrDefault ( c => c . Key . ToLower ( ) == msgStrip . ToLower ( ) ) . Value
91+ ) ;
92+
8993 }
90- }
91-
92- if ( msg . HasStringPrefix ( prefix , ref argPos ) || msg . HasMentionPrefix ( _client . CurrentUser , ref argPos ) )
93- {
94+
9495 var result = await _service . ExecuteAsync ( ctx , argPos ) ;
9596
9697 if ( result . IsSuccess == false && result . ErrorReason != "Unknown command." )
You can’t perform that action at this time.
0 commit comments