Remove messages
This commit is contained in:
		
							parent
							
								
									3f4d785bcb
								
							
						
					
					
						commit
						4ef8243e22
					
				@ -97,17 +97,13 @@ let getInvitedUsers userId =
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
let createGuildInvite (ctx : IDiscordContext) =
 | 
					let createGuildInvite (ctx : IDiscordContext) =
 | 
				
			||||||
    task {
 | 
					    task {
 | 
				
			||||||
        printfn $"{GuildEnvironment.channelWelcome}"
 | 
					        let channel = ctx.GetGuild().Channels.[GuildEnvironment.channelWelcome]
 | 
				
			||||||
        let ( result , channel ) = ctx.GetGuild().Channels.TryGetValue(GuildEnvironment.channelWelcome)
 | 
					 | 
				
			||||||
        printfn $"{result} {channel.Name}"
 | 
					 | 
				
			||||||
        let! invite = channel.CreateInviteAsync(max_age = 86400)
 | 
					        let! invite = channel.CreateInviteAsync(max_age = 86400)
 | 
				
			||||||
        printfn $"{invite.Code}"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // When a player generates an invite code but it hasn't expired, it generates the same code, creating a duplicate entry
 | 
					        // When a player generates an invite code but it hasn't expired, it generates the same code, creating a duplicate entry
 | 
				
			||||||
        // so catch the exception thrown because the code column is unique
 | 
					        // so catch the exception thrown because the code column is unique
 | 
				
			||||||
        try
 | 
					        try
 | 
				
			||||||
            let! result = createInvite (ctx.GetDiscordMember().Id) invite.Code
 | 
					            let! _ = createInvite (ctx.GetDiscordMember().Id) invite.Code
 | 
				
			||||||
            printfn "%A" result
 | 
					 | 
				
			||||||
            return ()
 | 
					            return ()
 | 
				
			||||||
        with ex ->
 | 
					        with ex ->
 | 
				
			||||||
            printfn "%A" ex.Message
 | 
					            printfn "%A" ex.Message
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user