Skip to content

Commit 9448780

Browse files
authored
Merge pull request #52 from bman46/51-Disabled-Embed-Title
51 - Disable Embed Title
2 parents cca9860 + 4fcc1ac commit 9448780

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Instagram Reels Bot/Modules/TextCommands.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using System.Threading.Tasks;
44
using System.IO;
55
using Instagram_Reels_Bot.Helpers;
6+
using Microsoft.Extensions.Configuration;
7+
using System;
68

79
namespace Instagram_Reels_Bot.Modules
810
{
@@ -132,9 +134,14 @@ private static async Task Responder(string url, ICommandContext context)
132134
await context.Message.ReplyAsync(response.error);
133135
return;
134136
}
137+
// Check config:
138+
var _builder = new ConfigurationBuilder()
139+
.SetBasePath(AppContext.BaseDirectory)
140+
.AddJsonFile(path: "config.json");
141+
var _config = _builder.Build();
135142

136143
// Embed builder:
137-
IGEmbedBuilder embed = new IGEmbedBuilder(response, context.User.Username);
144+
IGEmbedBuilder embed = (!string.IsNullOrEmpty(_config["DisableTitle"]) && _config["DisableTitle"].ToLower() == "true") ? (new IGEmbedBuilder(response)) : (new IGEmbedBuilder(response, context.User.Username));
138145
IGComponentBuilder component = new IGComponentBuilder(response, context.User.Id);
139146

140147
if (response.isVideo)

Instagram Reels Bot/Services/CommandHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public async Task MessageReceivedAsync(SocketMessage rawMessage)
113113
//IP check:
114114
try
115115
{
116-
OpenGraph graph = OpenGraph.ParseUrl("https://api.ipify.org/", "");
116+
OpenGraph graph = await OpenGraph.ParseUrlAsync("https://api.ipify.org/", "");
117117
await message.ReplyAsync("IP: " + graph.OriginalHtml);
118118
}
119119
catch (Exception e)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ Create a new file named `config.json`, copy and paste the contents below into it
4646
"ProxyUsername": "username (optional)",
4747
"ProxyPassword": "password (optional)",
4848
49+
"DisableTitle": false,
50+
4951
"AllowSubscriptions": true/false,
5052
"MongoDBUrl": "MongoDB Connection String (Required for subscriptions)",
5153
"DefaultSubscriptionsPerGuildMax": 1,

0 commit comments

Comments
 (0)