Add google command, small change in dice and help commands

This commit is contained in:
Runebaas 2017-09-19 18:53:59 +02:00
parent e57b80d4b4
commit 3a5a0df846
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
6 changed files with 65 additions and 46 deletions

View file

@ -1,43 +1,43 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<ApplicationIcon>derp.ico</ApplicationIcon> <ApplicationIcon>derp.ico</ApplicationIcon>
<Version>1.1.0</Version> <Version>1.1.0</Version>
<Company>Pizza and Coffee Studios</Company> <Company>Pizza and Coffee Studios</Company>
<Authors>Pizza and Coffee Studios</Authors> <Authors>Pizza and Coffee Studios</Authors>
<Description>A Discord bot</Description> <Description>A Discord bot</Description>
<RepositoryUrl>https://github.com/pizzaandcoffee/Geekbot.net</RepositoryUrl> <RepositoryUrl>https://github.com/pizzaandcoffee/Geekbot.net</RepositoryUrl>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Discord.Net"> <PackageReference Include="Discord.Net">
<Version>1.0.2</Version> <Version>1.0.2</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Google.Apis.YouTube.v3"> <PackageReference Include="Google.Apis.YouTube.v3">
<Version>1.29.1.976</Version> <Version>1.29.1.976</Version>
</PackageReference> </PackageReference>
<PackageReference Include="HtmlAgilityPack.NetCore"> <PackageReference Include="HtmlAgilityPack.NetCore">
<Version>1.5.0.1</Version> <Version>1.5.0.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.0.0" /> <PackageReference Include="Microsoft.Extensions.Options" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="RestSharp.NetCore"> <PackageReference Include="RestSharp.NetCore">
<Version>105.2.3</Version> <Version>105.2.3</Version>
</PackageReference> </PackageReference>
<PackageReference Include="StackExchange.Redis"> <PackageReference Include="StackExchange.Redis">
<Version>1.2.6</Version> <Version>1.2.6</Version>
</PackageReference> </PackageReference>
<PackageReference Include="System.Net.Http"> <PackageReference Include="System.Net.Http">
<Version>4.3.2</Version> <Version>4.3.2</Version>
</PackageReference> </PackageReference>
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" /> <PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Json"> <PackageReference Include="System.Runtime.Serialization.Json">
<Version>4.3.0</Version> <Version>4.3.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="System.Runtime.Serialization.Primitives"> <PackageReference Include="System.Runtime.Serialization.Primitives">
<Version>4.3.0</Version> <Version>4.3.0</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -63,8 +63,8 @@ namespace Geekbot.net.Modules
total = total + roll; total = total + roll;
} }
eb.AddField("Total", modifier == 0 ? $"{total}" : $"{total} (+{modifier})"); eb.AddField("Total", modifier == 0 ? $"{total}" : $"{total + modifier} ({total} +{modifier})");
await ReplyAsync("", false, eb.Build()); await ReplyAsync("", false, eb.Build());
} }
} }
} }

View file

@ -0,0 +1,17 @@
using System.Threading.Tasks;
using Discord.Commands;
namespace Geekbot.net.Modules
{
public class Google : ModuleBase
{
[Command("google", RunMode = RunMode.Async)]
[Summary("Google Something.")]
public async Task Eyes([Remainder, Summary("SearchText")] string searchText)
{
var url = $"http://lmgtfy.com/?q={searchText.Replace(' ', '+')}";
await ReplyAsync($"Please click here :unamused:\r\n{url}");
}
}
}

View file

@ -29,7 +29,7 @@ namespace Geekbot.net.Modules
if (!param.Contains("admin")) if (!param.Contains("admin"))
if (cmd.Parameters.Any()) if (cmd.Parameters.Any())
sb.AppendLine(tp(param, 15) + sb.AppendLine(tp(param, 15) +
tp(string.Join(",", cmd.Parameters.Select(e => e.Summary)), 19) + tp(string.Join(" ", cmd.Parameters.Select(e => e.Summary)), 19) +
cmd.Summary); cmd.Summary);
else else
sb.AppendLine(tp(param, 34) + cmd.Summary); sb.AppendLine(tp(param, 34) + cmd.Summary);

View file

@ -1,4 +1,5 @@
using System.Threading.Tasks; using System.Linq;
using System.Threading.Tasks;
using Discord.Commands; using Discord.Commands;
namespace Geekbot.net.Modules namespace Geekbot.net.Modules

View file

@ -42,6 +42,7 @@ namespace Geekbot.net
{ {
var redisMultiplexer = ConnectionMultiplexer.Connect("127.0.0.1:6379"); var redisMultiplexer = ConnectionMultiplexer.Connect("127.0.0.1:6379");
redis = redisMultiplexer.GetDatabase(6); redis = redisMultiplexer.GetDatabase(6);
Console.WriteLine("- Connected to Redis (db6)");
} }
catch (Exception) catch (Exception)
{ {