Compare commits
22 Commits
debug_bran
...
e43cd71a7d
Author | SHA1 | Date | |
---|---|---|---|
|
e43cd71a7d | ||
|
b74c666d05 | ||
|
8058bffba5 | ||
|
ed5f4d729e | ||
|
4907fe44f2 | ||
|
2f04b31973 | ||
|
0c6733ac77 | ||
|
89139869c2 | ||
|
e1924269aa | ||
|
f5c28140c7 | ||
|
373f1ec2eb | ||
|
96ebf7b07c | ||
|
45878f5fcc | ||
|
104ea6e7bd | ||
|
0447308f40 | ||
|
e3d69dd9c5 | ||
|
e07853a8dd | ||
|
d478e550ba | ||
|
e094766bf4 | ||
|
9c7d370b5b | ||
|
a67f6f1666 | ||
|
8d0093f1d3 |
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace EventBot.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
|
||||
class ExampleAttribute : Attribute
|
||||
{
|
||||
public string Use { get; set; }
|
||||
public ExampleAttribute(string use)
|
||||
{
|
||||
Use = use;
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,10 +7,10 @@ COPY ["EventBot/EventBot.csproj", "EventBot/"]
|
||||
RUN dotnet restore "EventBot/EventBot.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/EventBot"
|
||||
RUN dotnet build "EventBot.csproj" -c Debug -o /app
|
||||
RUN dotnet build "EventBot.csproj" -c Release -o /app
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "EventBot.csproj" -c Debug -o /app
|
||||
RUN dotnet publish "EventBot.csproj" -c Release -o /app
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
|
@@ -9,15 +9,15 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Discord.Addons.Interactive" Version="1.0.1" />
|
||||
<PackageReference Include="Discord.Net" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.design" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.6">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.design" Version="2.2.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.2.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.9.5" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.7.9" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@@ -88,7 +88,7 @@ namespace EventBot.Modules
|
||||
.Aggregate(true, (a, r) => a && r))
|
||||
.SelectMany(c => c.Aliases.Select(a => new { CI = c, MA = (c.Aliases[0] == a), A = a }).Reverse())
|
||||
.Select((e, i) => new { Command = e, Index = i })
|
||||
.GroupBy(o => o.Index / 15)
|
||||
.GroupBy(o => o.Index / 30)
|
||||
.Select(g => g.Select(o => o.Command));
|
||||
|
||||
var pager = new PaginatedMessage()
|
||||
@@ -130,9 +130,6 @@ namespace EventBot.Modules
|
||||
embed.AddField("Parameters",
|
||||
string.Join("\r\n", command.Parameters.Select(p => $"`{p.FormatParameter()}` *(Type: {p.FormatParameterType()})* - **{p.Summary}** {(p.IsRemainder ? "_No quotes are needed, when providing this parameter._" : "")}" ))
|
||||
);
|
||||
var examples = command.Attributes.Where(a => a is ExampleAttribute).Select(a => ((ExampleAttribute)a).Use).ToArray();
|
||||
if (examples.Length != 0)
|
||||
embed.AddField("Examples", $"```{string.Join("\r\n", examples)}```");
|
||||
|
||||
await ReplyAsync($"I got this information about command `{commandAlias}`:", embed: embed.Build());
|
||||
}
|
||||
|
@@ -9,7 +9,6 @@ using System.Linq;
|
||||
using EventBot.Entities;
|
||||
using Discord.WebSocket;
|
||||
using Discord.Addons.Interactive;
|
||||
using EventBot.Attributes;
|
||||
|
||||
namespace EventBot.Modules
|
||||
{
|
||||
@@ -29,9 +28,6 @@ namespace EventBot.Modules
|
||||
[Alias("j")]
|
||||
[Name("Join event")]
|
||||
[Summary("Joins latest or specified event with specified event role.")]
|
||||
[Example("join :slight_smile:")]
|
||||
[Example("join 5 \"John Smith\"")]
|
||||
[Example("join :gun: \"Tpr. James\" 2")]
|
||||
public async Task JoinEvent(
|
||||
[Summary("Role emote or role ID to join the most recent event.")] string emoteOrId,
|
||||
[Summary("Extra information that might be needed by organizers.")] string extraInformation = null,
|
||||
@@ -133,8 +129,6 @@ namespace EventBot.Modules
|
||||
[Alias("add", "create")]
|
||||
[Name("Create event")]
|
||||
[Summary("Creates a new event.")]
|
||||
[Example("event new \"The event\" \"This is going to be a very hard event to organize.\"")]
|
||||
[Example("event new \"Departmental chaos\" \"This event is about departmental workers rising against heads. Please provide your character name during registration.\" Detailed")]
|
||||
public async Task CreateEvent(
|
||||
[Summary("Title for the event.")] string title,
|
||||
[Summary("Description for the event.")] string description,
|
||||
@@ -200,8 +194,6 @@ namespace EventBot.Modules
|
||||
[Command("update type")]
|
||||
[Name("Update event's type")]
|
||||
[Summary("Updates the event type.")]
|
||||
[Example("event update type Quick")]
|
||||
[Example("event update type Detailed 3")]
|
||||
public async Task UpdateEventType(
|
||||
[Summary("Type of event registration.")] Event.EventParticipactionType type,
|
||||
[Summary("Event to update, if not specified, updates latest event.")] Event @event = null)
|
||||
@@ -228,9 +220,6 @@ namespace EventBot.Modules
|
||||
[Alias("role add", "role create")]
|
||||
[Name("Add role")]
|
||||
[Summary("Adds a new role to the event.")]
|
||||
[Example("event role new \"ERT\" \"Emergency response team that recovers the artifact.\" :gun:")]
|
||||
[Example("event role new \"Ninja\" \"To sneak around various corners of the station.\" :fire: 1")]
|
||||
[Example("event role new \"Mercenaries\" \"To go on the station and do stuff.\" :fingers_crossed: 6 2")]
|
||||
public async Task NewEventRole(
|
||||
[Summary("Title of the role.")] string title,
|
||||
[Summary("Description of the role.")] string description,
|
||||
@@ -288,10 +277,6 @@ namespace EventBot.Modules
|
||||
throw new Exception("This event is finalized. Please make a new event.");
|
||||
eventRole.Title = title;
|
||||
var s = _database.SaveChangesAsync();
|
||||
if (eventRole.ChannelId != 0)
|
||||
await Context.Guild.GetTextChannel(eventRole.ChannelId).ModifyAsync(p => p.Name = eventRole.ChannelName);
|
||||
if (eventRole.RoleId != 0)
|
||||
await Context.Guild.GetRole(eventRole.RoleId).ModifyAsync(p => p.Name = eventRole.Title);
|
||||
await ReplyAsync($"Updated event role `{eventRole.Id}`'s title to `{eventRole.Title}`");
|
||||
await s;
|
||||
await _events.UpdateEventMessage(eventRole.Event);
|
||||
@@ -581,10 +566,7 @@ namespace EventBot.Modules
|
||||
[Priority(2)]
|
||||
[Command("participant add")]
|
||||
[Name("Add participant")]
|
||||
[Summary("Add user to event role. Acts like join command. Works even if registration is closed.")]
|
||||
[Example("participant add \"Mini Moose#6944\" :slight_smile:")]
|
||||
[Example("participant add Arrow768#3092 5 \"John Smith\"")]
|
||||
[Example("participant add 183658981019877376 :gun: \"Tpr. James\" 2")]
|
||||
[Summary("Add user to event role. Acts like join command.")]
|
||||
public async Task EventParticipantAdd(
|
||||
[Summary("User ID or discord mention.")] IUser user,
|
||||
[Summary("Role emote or role ID to join.")] string emoteOrId,
|
||||
|
@@ -49,7 +49,12 @@ namespace EventBot
|
||||
private ServiceProvider ConfigureServices()
|
||||
{
|
||||
return new ServiceCollection()
|
||||
.AddSingleton(s => new DiscordSocketClient(getDiscordSocketConfig()))
|
||||
.AddSingleton(s => new DiscordSocketClient(new DiscordSocketConfig() {
|
||||
#if DEBUG
|
||||
LogLevel = LogSeverity.Debug,
|
||||
#endif
|
||||
MessageCacheSize = 1500
|
||||
}))
|
||||
.AddSingleton<CommandService>()
|
||||
.AddSingleton<CommandHandlingService>()
|
||||
.AddSingleton<EventManagementService>()
|
||||
@@ -64,19 +69,5 @@ namespace EventBot
|
||||
//.AddSingleton<PictureService>()
|
||||
.BuildServiceProvider();
|
||||
}
|
||||
|
||||
private DiscordSocketConfig getDiscordSocketConfig()
|
||||
{
|
||||
var config = new DiscordSocketConfig()
|
||||
{
|
||||
MessageCacheSize = 1500
|
||||
};
|
||||
#if DEBUG
|
||||
config.LogLevel = LogSeverity.Debug;
|
||||
#endif
|
||||
if(Environment.GetEnvironmentVariable("DEBUG") != null)
|
||||
config.LogLevel = LogSeverity.Debug;
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,8 +3,8 @@
|
||||
"EventBot": {
|
||||
"commandName": "Project",
|
||||
"environmentVariables": {
|
||||
"dbconnection": "Server=server;Database=eventbot;User=eventbot;Password=password;",
|
||||
"token": "token here"
|
||||
"dbconnection": "Server=localhost;Database=eventbot;User=root;Password=tux;",
|
||||
"token": "<insert Token here>"
|
||||
}
|
||||
},
|
||||
"Docker": {
|
||||
|
Reference in New Issue
Block a user