mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-04 00:34:26 -05:00 
			
		
		
		
	Removed some useless code
This commit is contained in:
		@@ -125,13 +125,12 @@ public class GameStatusEvent : ICurrencyEvent
 | 
			
		||||
            await StopEvent();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public async Task StopEvent()
 | 
			
		||||
    public Task StopEvent()
 | 
			
		||||
    {
 | 
			
		||||
        await Task.Yield();
 | 
			
		||||
        lock (_stopLock)
 | 
			
		||||
        {
 | 
			
		||||
            if (Stopped)
 | 
			
		||||
                return;
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
            Stopped = true;
 | 
			
		||||
            _client.MessageDeleted -= OnMessageDeleted;
 | 
			
		||||
            _client.MessageReceived -= HandleMessage;
 | 
			
		||||
@@ -146,6 +145,8 @@ public class GameStatusEvent : ICurrencyEvent
 | 
			
		||||
 | 
			
		||||
            _ = OnEnded?.Invoke(_guild.Id);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return Task.CompletedTask;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Task HandleMessage(SocketMessage message)
 | 
			
		||||
 
 | 
			
		||||
@@ -122,13 +122,13 @@ public class ReactionEvent : ICurrencyEvent
 | 
			
		||||
            await StopEvent();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public async Task StopEvent()
 | 
			
		||||
    public Task StopEvent()
 | 
			
		||||
    {
 | 
			
		||||
        await Task.Yield();
 | 
			
		||||
        lock (_stopLock)
 | 
			
		||||
        {
 | 
			
		||||
            if (Stopped)
 | 
			
		||||
                return;
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
            
 | 
			
		||||
            Stopped = true;
 | 
			
		||||
            _client.MessageDeleted -= OnMessageDeleted;
 | 
			
		||||
            _client.ReactionAdded -= HandleReaction;
 | 
			
		||||
@@ -142,6 +142,8 @@ public class ReactionEvent : ICurrencyEvent
 | 
			
		||||
 | 
			
		||||
            _ = OnEnded?.Invoke(_guild.Id);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return Task.CompletedTask;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Task HandleReaction(
 | 
			
		||||
 
 | 
			
		||||
@@ -102,7 +102,6 @@ public class PermissionService : ILateBlocker, INService
 | 
			
		||||
        var channel = ctx.Channel;
 | 
			
		||||
        var commandName = command.Name.ToLowerInvariant();
 | 
			
		||||
 | 
			
		||||
        await Task.Yield();
 | 
			
		||||
        if (guild is null)
 | 
			
		||||
            return false;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -197,12 +197,12 @@ public class GoogleApiService : IGoogleApiService, INService
 | 
			
		||||
    // todo future add quota users
 | 
			
		||||
    public async Task<IEnumerable<string>> GetRelatedVideosAsync(string id, int count = 1)
 | 
			
		||||
    {
 | 
			
		||||
        await Task.Yield();
 | 
			
		||||
        if (string.IsNullOrWhiteSpace(id))
 | 
			
		||||
            throw new ArgumentNullException(nameof(id));
 | 
			
		||||
 | 
			
		||||
        if (count <= 0)
 | 
			
		||||
            throw new ArgumentOutOfRangeException(nameof(count));
 | 
			
		||||
        
 | 
			
		||||
        var query = _yt.Search.List("snippet");
 | 
			
		||||
        query.MaxResults = count;
 | 
			
		||||
        query.RelatedToVideoId = id;
 | 
			
		||||
@@ -212,7 +212,6 @@ public class GoogleApiService : IGoogleApiService, INService
 | 
			
		||||
 | 
			
		||||
    public async Task<IEnumerable<string>> GetVideoLinksByKeywordAsync(string keywords, int count = 1)
 | 
			
		||||
    {
 | 
			
		||||
        await Task.Yield();
 | 
			
		||||
        if (string.IsNullOrWhiteSpace(keywords))
 | 
			
		||||
            throw new ArgumentNullException(nameof(keywords));
 | 
			
		||||
 | 
			
		||||
@@ -231,7 +230,6 @@ public class GoogleApiService : IGoogleApiService, INService
 | 
			
		||||
        string keywords,
 | 
			
		||||
        int count = 1)
 | 
			
		||||
    {
 | 
			
		||||
        await Task.Yield();
 | 
			
		||||
        if (string.IsNullOrWhiteSpace(keywords))
 | 
			
		||||
            throw new ArgumentNullException(nameof(keywords));
 | 
			
		||||
 | 
			
		||||
@@ -251,7 +249,6 @@ public class GoogleApiService : IGoogleApiService, INService
 | 
			
		||||
 | 
			
		||||
    public async Task<string> ShortenUrl(string url)
 | 
			
		||||
    {
 | 
			
		||||
        await Task.Yield();
 | 
			
		||||
        if (string.IsNullOrWhiteSpace(url))
 | 
			
		||||
            throw new ArgumentNullException(nameof(url));
 | 
			
		||||
 | 
			
		||||
@@ -280,7 +277,6 @@ public class GoogleApiService : IGoogleApiService, INService
 | 
			
		||||
 | 
			
		||||
    public async Task<IEnumerable<string>> GetPlaylistTracksAsync(string playlistId, int count = 50)
 | 
			
		||||
    {
 | 
			
		||||
        await Task.Yield();
 | 
			
		||||
        if (string.IsNullOrWhiteSpace(playlistId))
 | 
			
		||||
            throw new ArgumentNullException(nameof(playlistId));
 | 
			
		||||
 | 
			
		||||
@@ -312,7 +308,6 @@ public class GoogleApiService : IGoogleApiService, INService
 | 
			
		||||
 | 
			
		||||
    public async Task<IReadOnlyDictionary<string, TimeSpan>> GetVideoDurationsAsync(IEnumerable<string> videoIds)
 | 
			
		||||
    {
 | 
			
		||||
        await Task.Yield();
 | 
			
		||||
        var videoIdsList = videoIds as List<string> ?? videoIds.ToList();
 | 
			
		||||
 | 
			
		||||
        var toReturn = new Dictionary<string, TimeSpan>();
 | 
			
		||||
@@ -339,7 +334,6 @@ public class GoogleApiService : IGoogleApiService, INService
 | 
			
		||||
 | 
			
		||||
    public async Task<ImageResult> GetImageAsync(string query)
 | 
			
		||||
    {
 | 
			
		||||
        await Task.Yield();
 | 
			
		||||
        if (string.IsNullOrWhiteSpace(query))
 | 
			
		||||
            throw new ArgumentNullException(nameof(query));
 | 
			
		||||
 | 
			
		||||
@@ -359,7 +353,6 @@ public class GoogleApiService : IGoogleApiService, INService
 | 
			
		||||
 | 
			
		||||
    public async Task<string> Translate(string sourceText, string sourceLanguage, string targetLanguage)
 | 
			
		||||
    {
 | 
			
		||||
        await Task.Yield();
 | 
			
		||||
        string text;
 | 
			
		||||
 | 
			
		||||
        if (!Languages.ContainsKey(sourceLanguage) || !Languages.ContainsKey(targetLanguage))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user