Skip to content

Commit dbdce42

Browse files
committed
2022, CommandData bot ref
1 parent a3acfd7 commit dbdce42

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

CommandData.cs

+3
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@ public class CommandData
2121
/// Set to 'true' when the command was written like "@Bot commandhere", set to 'false' when the command was written with a prefix like "!commandhere" (or other special execution method).
2222
/// </summary>
2323
public bool WasBotMention;
24+
25+
/// <summary>The relevant bot instance.</summary>
26+
public DiscordBot Bot;
2427
}
2528
}

DiscordBot.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void Respond(IUserMessage message, bool outputUnknowns, bool wasMentioned
103103
string commandNameLowered = argsCleaned[0].ToLowerFast();
104104
argsCleaned.RemoveAt(0);
105105
argsRaw.RemoveAt(0);
106-
CommandData commandData = new() { Message = message, CleanedArguments = argsCleaned.ToArray(), RawArguments = argsRaw.ToArray(), WasBotMention = wasMentioned };
106+
CommandData commandData = new() { Message = message, CleanedArguments = argsCleaned.ToArray(), RawArguments = argsRaw.ToArray(), WasBotMention = wasMentioned, Bot = this };
107107
if (ChatCommands.TryGetValue(commandNameLowered, out Action<CommandData> commandHandlerMethod))
108108
{
109109
commandHandlerMethod.Invoke(commandData);

LICENSE.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2020-2021 Alex "mcmonkey" Goodwin
3+
Copyright (c) 2020-2022 Alex "mcmonkey" Goodwin
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This is a base/template codebase for my Discord bots. Generally not really meant
77

88
The MIT License (MIT)
99

10-
Copyright (c) 2020-2021 Alex "mcmonkey" Goodwin
10+
Copyright (c) 2020-2022 Alex "mcmonkey" Goodwin
1111

1212
Permission is hereby granted, free of charge, to any person obtaining a copy
1313
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)