d4n3436 / Fergun

A utility Discord bot written in C# using Discord.Net
MIT License
30 stars 10 forks source link

Bot not starting (Long Error) #12

Closed HyunJae5463 closed 1 year ago

HyunJae5463 commented 1 year ago

When i try to start the bot it gives me this error:

Unhandled exception. System.Exception: Failed to create "Fergun.Modules.ImageModule".
 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: Failed to convert configuration value at 'Fergun:PaginatorEmotes:SkipToEnd' to type 'Discord.IEmote'.
 ---> System.FormatException: String is not emoji name or unicode!
   at Discord.Emoji.Parse(String emojiStr)
   at Fergun.Converters.EmoteConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) in F:\OCR Bot\Fergun\src\Converters\EmoteConverter.cs:line 27
   at System.ComponentModel.TypeConverter.ConvertFromInvariantString(String text)
   at Microsoft.Extensions.Configuration.ConfigurationBinder.TryConvertValue(Type type, String value, String path, Object& result, Exception& error)
   --- End of inner exception stack trace ---
   at Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance(Type type, Object instance, IConfiguration config, BinderOptions options)
   at Microsoft.Extensions.Configuration.ConfigurationBinder.BindDictionary(Object dictionary, Type dictionaryType, IConfiguration config, BinderOptions options)
   at Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance(Type type, Object instance, IConfiguration config, BinderOptions options)
   at Microsoft.Extensions.Configuration.ConfigurationBinder.GetPropertyValue(PropertyInfo property, Object instance, IConfiguration config, BinderOptions options)
   at Microsoft.Extensions.Configuration.ConfigurationBinder.BindProperty(PropertyInfo property, Object instance, IConfiguration config, BinderOptions options)
   at Microsoft.Extensions.Configuration.ConfigurationBinder.BindNonScalar(IConfiguration configuration, Object instance, BinderOptions options)
   at Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance(Type type, Object instance, IConfiguration config, BinderOptions options)
   at Microsoft.Extensions.Configuration.ConfigurationBinder.Bind(IConfiguration configuration, Object instance, Action`1 configureOptions)
   at Microsoft.Extensions.DependencyInjection.OptionsBuilderConfigurationExtensions.BindFromOptions[TOptions](TOptions opts, IConfiguration config, String configSectionPath, Action`1 configureBinder)
   at Microsoft.Extensions.DependencyInjection.OptionsBuilderConfigurationExtensions.<>c__DisplayClass3_0`1.<BindConfiguration>b__0(TOptions opts, IConfiguration config)
   at Microsoft.Extensions.Options.ConfigureNamedOptions`2.Configure(String name, TOptions options)
   at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
   at Microsoft.Extensions.Options.OptionsManager`1.<>c__DisplayClass5_0.<Get>b__0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd(String name, Func`1 createOptions)
   at Microsoft.Extensions.Options.OptionsManager`1.Get(String name)
   at Microsoft.Extensions.Options.OptionsManager`1.get_Value()
   at Fergun.Modules.ImageModule..ctor(ILogger`1 logger, IFergunLocalizer`1 localizer, IOptionsSnapshot`1 fergunOptions, InteractiveService interactive, GoogleScraper googleScraper, DuckDuckGoScraper duckDuckGoScraper, IBingVisualSearch bingVisualSearch, IYandexImageSearch yandexImageSearch) in F:\OCR Bot\Fergun\src\Modules\ImageModule.cs:line 42
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
   at Discord.Interactions.ReflectionUtils`1.InvokeConstructor(ConstructorInfo constructor, Object[] args, TypeInfo ownerType)
   --- End of inner exception stack trace ---
   at Discord.Interactions.ReflectionUtils`1.InvokeConstructor(ConstructorInfo constructor, Object[] args, TypeInfo ownerType)
   at Discord.Interactions.ReflectionUtils`1.<>c__DisplayClass2_0.<CreateBuilder>b__0(IServiceProvider services)
   at Discord.Interactions.ReflectionUtils`1.CreateObject(TypeInfo typeInfo, InteractionService commandService, IServiceProvider services)
   at Discord.Interactions.Builders.ModuleBuilder.Build(InteractionService interactionService, IServiceProvider services, ModuleInfo parent)
   at Discord.Interactions.Builders.ModuleClassBuilder.BuildAsync(IEnumerable`1 validTypes, InteractionService commandService, IServiceProvider services)
   at Discord.Interactions.InteractionService.AddModulesAsync(Assembly assembly, IServiceProvider services)
   at Fergun.Services.InteractionHandlingService.StartAsync(CancellationToken cancellationToken) in F:\OCR Bot\Fergun\src\Services\InteractionHandlingService.cs:line 63
   at Fergun.Services.InteractionHandlingService.StartAsync(CancellationToken cancellationToken) in F:\OCR Bot\Fergun\src\Services\InteractionHandlingService.cs:line 69
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Program.<Main>$(String[] args) in F:\OCR Bot\Fergun\src\Program.cs:line 211
   at Program.<Main>(String[] args)
[11:46:33 ERR] Gateway:
System.ObjectDisposedException: The semaphore has been disposed.
   at System.Threading.SemaphoreSlim.CheckDispose()
   at System.Threading.SemaphoreSlim.Release(Int32 releaseCount)
   at System.Threading.SemaphoreSlim.Release()
   at Discord.API.DiscordSocketApiClient.ConnectAsync()
   at Discord.WebSocket.DiscordSocketClient.OnConnectingAsync()
   at Discord.ConnectionManager.ConnectAsync(CancellationTokenSource reconnectCancelToken)
   at Discord.ConnectionManager.<>c__DisplayClass29_0.<<StartAsync>b__0>d.MoveNext()
[11:46:33 INF] Gateway: Disconnecting
d4n3436 commented 1 year ago

You need a valid configuration value for PaginatotEmotes:SkipToEnd in the appsettings.json file. There should be a default value unless you changed or deleted it.

HyunJae5463 commented 1 year ago

Fixed it by removing the whole Emote part.