Compare commits

..

22 Commits

Author SHA1 Message Date
Karolis2011
e43cd71a7d Read ME update 2019-06-20 11:20:01 +03:00
Karolis2011
b74c666d05 Adds role specific channels. 2019-06-20 11:19:39 +03:00
Karolis2011
8058bffba5 Help part 2 2019-06-20 01:01:49 +03:00
Karolis2011
ed5f4d729e Better help part 1 2019-06-19 23:59:48 +03:00
Karolis
4907fe44f2 Merge pull request #1 from Geevies/spellChecks
Minor Spelling Mistake fixes
2019-06-19 19:20:31 +03:00
Geeves
2f04b31973 Update EventBot/Modules/EventModule.cs 2019-06-19 17:36:38 +02:00
Geeves
0c6733ac77 Update EventBot/Modules/EventModule.cs 2019-06-19 17:36:21 +02:00
Geeves
89139869c2 Update EventBot/Modules/EventModule.cs 2019-06-19 17:36:03 +02:00
Geeves
e1924269aa Update EventBot/Modules/EventModule.cs
Co-Authored-By: Karolis <Karolis2011@users.noreply.github.com>
2019-06-19 17:28:58 +02:00
Geeves
f5c28140c7 Update EventBot/Modules/EventModule.cs
Co-Authored-By: Karolis <Karolis2011@users.noreply.github.com>
2019-06-19 17:28:47 +02:00
Geeves
373f1ec2eb Update EventBot/Modules/EventModule.cs
Co-Authored-By: Karolis <Karolis2011@users.noreply.github.com>
2019-06-19 17:28:11 +02:00
Geeves
96ebf7b07c Update EventBot/Modules/EventModule.cs
Co-Authored-By: Karolis <Karolis2011@users.noreply.github.com>
2019-06-19 17:27:19 +02:00
Geeves
45878f5fcc Update EventBot/Modules/EventModule.cs
Co-Authored-By: Karolis <Karolis2011@users.noreply.github.com>
2019-06-19 17:23:47 +02:00
Geeves
104ea6e7bd Update EventBot/Modules/EventModule.cs
Co-Authored-By: Karolis <Karolis2011@users.noreply.github.com>
2019-06-19 17:14:00 +02:00
Geeves
0447308f40 Update EventBot/Modules/EventModule.cs
Co-Authored-By: Karolis <Karolis2011@users.noreply.github.com>
2019-06-19 17:13:46 +02:00
Geeves
e3d69dd9c5 Update EventBot/Misc/EventRoleTypeReader.cs
Co-Authored-By: Karolis <Karolis2011@users.noreply.github.com>
2019-06-19 17:13:29 +02:00
Geeves
e07853a8dd final commit 2019-06-19 07:12:22 +02:00
Geeves
d478e550ba Merge pull request #1 from Karolis2011/master
Update with master
2019-06-19 07:06:34 +02:00
Geeves
e094766bf4 spellfixes for commands 2019-06-18 23:24:12 +02:00
Karolis2011
9c7d370b5b Travis you can do it. 2019-06-19 00:23:15 +03:00
Karolis2011
a67f6f1666 Addes travis and README 2019-06-19 00:17:44 +03:00
Geeves
8d0093f1d3 spellfixes 2019-06-18 22:43:41 +02:00
7 changed files with 18 additions and 64 deletions

View File

@@ -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;
}
}
}

View File

@@ -7,10 +7,10 @@ COPY ["EventBot/EventBot.csproj", "EventBot/"]
RUN dotnet restore "EventBot/EventBot.csproj" RUN dotnet restore "EventBot/EventBot.csproj"
COPY . . COPY . .
WORKDIR "/src/EventBot" 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 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 FROM base AS final
WORKDIR /app WORKDIR /app

View File

@@ -9,15 +9,15 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Discord.Addons.Interactive" Version="1.0.1" /> <PackageReference Include="Discord.Addons.Interactive" Version="1.0.1" />
<PackageReference Include="Discord.Net" Version="2.1.1" /> <PackageReference Include="Discord.Net" Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.design" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.design" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.6"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.4">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </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" /> <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.0" />
</ItemGroup> </ItemGroup>

View File

@@ -88,7 +88,7 @@ namespace EventBot.Modules
.Aggregate(true, (a, r) => a && r)) .Aggregate(true, (a, r) => a && r))
.SelectMany(c => c.Aliases.Select(a => new { CI = c, MA = (c.Aliases[0] == a), A = a }).Reverse()) .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 }) .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)); .Select(g => g.Select(o => o.Command));
var pager = new PaginatedMessage() var pager = new PaginatedMessage()
@@ -130,9 +130,6 @@ namespace EventBot.Modules
embed.AddField("Parameters", 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._" : "")}" )) 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()); await ReplyAsync($"I got this information about command `{commandAlias}`:", embed: embed.Build());
} }

View File

@@ -9,7 +9,6 @@ using System.Linq;
using EventBot.Entities; using EventBot.Entities;
using Discord.WebSocket; using Discord.WebSocket;
using Discord.Addons.Interactive; using Discord.Addons.Interactive;
using EventBot.Attributes;
namespace EventBot.Modules namespace EventBot.Modules
{ {
@@ -29,9 +28,6 @@ namespace EventBot.Modules
[Alias("j")] [Alias("j")]
[Name("Join event")] [Name("Join event")]
[Summary("Joins latest or specified event with specified event role.")] [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( public async Task JoinEvent(
[Summary("Role emote or role ID to join the most recent event.")] string emoteOrId, [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, [Summary("Extra information that might be needed by organizers.")] string extraInformation = null,
@@ -133,8 +129,6 @@ namespace EventBot.Modules
[Alias("add", "create")] [Alias("add", "create")]
[Name("Create event")] [Name("Create event")]
[Summary("Creates a new 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( public async Task CreateEvent(
[Summary("Title for the event.")] string title, [Summary("Title for the event.")] string title,
[Summary("Description for the event.")] string description, [Summary("Description for the event.")] string description,
@@ -200,8 +194,6 @@ namespace EventBot.Modules
[Command("update type")] [Command("update type")]
[Name("Update event's type")] [Name("Update event's type")]
[Summary("Updates the event type.")] [Summary("Updates the event type.")]
[Example("event update type Quick")]
[Example("event update type Detailed 3")]
public async Task UpdateEventType( public async Task UpdateEventType(
[Summary("Type of event registration.")] Event.EventParticipactionType type, [Summary("Type of event registration.")] Event.EventParticipactionType type,
[Summary("Event to update, if not specified, updates latest event.")] Event @event = null) [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")] [Alias("role add", "role create")]
[Name("Add role")] [Name("Add role")]
[Summary("Adds a new role to the event.")] [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( public async Task NewEventRole(
[Summary("Title of the role.")] string title, [Summary("Title of the role.")] string title,
[Summary("Description of the role.")] string description, [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."); throw new Exception("This event is finalized. Please make a new event.");
eventRole.Title = title; eventRole.Title = title;
var s = _database.SaveChangesAsync(); 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 ReplyAsync($"Updated event role `{eventRole.Id}`'s title to `{eventRole.Title}`");
await s; await s;
await _events.UpdateEventMessage(eventRole.Event); await _events.UpdateEventMessage(eventRole.Event);
@@ -581,10 +566,7 @@ namespace EventBot.Modules
[Priority(2)] [Priority(2)]
[Command("participant add")] [Command("participant add")]
[Name("Add participant")] [Name("Add participant")]
[Summary("Add user to event role. Acts like join command. Works even if registration is closed.")] [Summary("Add user to event role. Acts like join command.")]
[Example("participant add \"Mini Moose#6944\" :slight_smile:")]
[Example("participant add Arrow768#3092 5 \"John Smith\"")]
[Example("participant add 183658981019877376 :gun: \"Tpr. James\" 2")]
public async Task EventParticipantAdd( public async Task EventParticipantAdd(
[Summary("User ID or discord mention.")] IUser user, [Summary("User ID or discord mention.")] IUser user,
[Summary("Role emote or role ID to join.")] string emoteOrId, [Summary("Role emote or role ID to join.")] string emoteOrId,

View File

@@ -49,7 +49,12 @@ namespace EventBot
private ServiceProvider ConfigureServices() private ServiceProvider ConfigureServices()
{ {
return new ServiceCollection() 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<CommandService>()
.AddSingleton<CommandHandlingService>() .AddSingleton<CommandHandlingService>()
.AddSingleton<EventManagementService>() .AddSingleton<EventManagementService>()
@@ -64,19 +69,5 @@ namespace EventBot
//.AddSingleton<PictureService>() //.AddSingleton<PictureService>()
.BuildServiceProvider(); .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;
}
} }
} }

View File

@@ -3,8 +3,8 @@
"EventBot": { "EventBot": {
"commandName": "Project", "commandName": "Project",
"environmentVariables": { "environmentVariables": {
"dbconnection": "Server=server;Database=eventbot;User=eventbot;Password=password;", "dbconnection": "Server=localhost;Database=eventbot;User=root;Password=tux;",
"token": "token here" "token": "<insert Token here>"
} }
}, },
"Docker": { "Docker": {