Skip to content

Commit 131c1d3

Browse files
committed
feat: add user input for channel and webhook message counts with default values
fix: update BotIsAdmin method to return clearer permission status
1 parent a51eeed commit 131c1d3

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

src/Program.cs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,32 @@ public static async Task Init()
116116
return;
117117
}
118118

119+
int channels_to_create = CHANNELS_TO_CREATE;
120+
121+
Console.Write($"[?] How many channels would you like to create? Press Enter to use the default ({channels_to_create}): ");
122+
string? channelsInput = Console.ReadLine();
123+
124+
if (!string.IsNullOrEmpty(channelsInput))
125+
{
126+
if (!int.TryParse(channelsInput, out channels_to_create))
127+
{
128+
channels_to_create = CHANNELS_TO_CREATE;
129+
}
130+
}
131+
132+
int messages_per_webhook = MESSAGES_PER_WEBHOOK;
133+
Console.Write($"[?] How many messages should each webhook send? Press Enter to keep the default ({messages_per_webhook}): ");
134+
string? webhookInput = Console.ReadLine();
135+
136+
if (!string.IsNullOrEmpty(webhookInput))
137+
{
138+
if (!int.TryParse(webhookInput, out messages_per_webhook))
139+
{
140+
messages_per_webhook = MESSAGES_PER_WEBHOOK;
141+
}
142+
}
143+
144+
119145
List<DiscordChannel>? channels = await Discord.GetChannels(token, guildId);
120146

121147
if (channels != null && channels.Count >= 1)
@@ -142,7 +168,7 @@ public static async Task Init()
142168
List<DiscordChannel> createdChannels = [];
143169
List<Task> creationTasks = [];
144170

145-
for (int i = 0; i < CHANNELS_TO_CREATE; i++)
171+
for (int i = 0; i < channels_to_create; i++)
146172
{
147173
var task = Task.Run(async () =>
148174
{
@@ -190,7 +216,7 @@ public static async Task Init()
190216
{
191217
_ = Task.Run(async () =>
192218
{
193-
for (int i = 0; i < MESSAGES_PER_WEBHOOK; i++)
219+
for (int i = 0; i < messages_per_webhook; i++)
194220
{
195221
await Discord.SendMessageToWebhook(webhook.url, content);
196222
}

src/Util.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public static string GetRandomName()
4848
return list[num];
4949
}
5050

51-
public static string BotIsAdmin(String? s)
51+
public static string BotIsAdmin(string? s)
5252
{
53-
return s != null && s.Equals(ADMIN_PERMISSION) ? "Yes" : "No";
53+
return s != null && s.Equals(ADMIN_PERMISSION) ? "YES" : "NO [!POTENTIAL MISSING PERMISSIONS!]";
5454
}
5555

5656
public static string GlobalTimeout(bool? b)

0 commit comments

Comments
 (0)