I want to make a link to the discord server, but the link is not clickable. What to do?
My code:
@ bot.command ()
async def help (ctx):
embed = discord.Embed (color = 0x232323, title = 'Command navigation')
embed.add_field (name = ': eyes: Bot info', value = '. info')
embed.add_field (name = ': detective: Utilities', value = '. utilities')
embed.add_field (name = ': video_game: Interesting game', value = '. game')
embed.add_field (name = ': hammer_pick: Moderation commands', value = '. moderation')
embed.add_field (name = ': radio: Ping', value = '. ping')
embed.add_field (name = 'Add bot to your server', value = '[Link to add] (https://discord.com/api/oauth2/authorize?client_id=794873293148651564&permissions=8&scope=bot)' , inline = False)
embed.add_field (name = 'Official bot server', value = '[Click] (https://discord.com/invite/urvGgmn5Fw)', inline = False)
await ctx.send (embed = embed) ,,,,
Answer 1
Propose to do it via Cog
Create a file in the same folder where the main bot file is named, for example, help.py and paste the code below:
import discord
from discord.ext import commands
from discord import utils
from discord.utils import get
import os
class Help (commands.Cog):
def __init __ (self, bot):
self.bot = bot
self.invite = '' # link to add the bot
self.server = '' # link to server
@ commands.command ()
async def help (self, ctx):
embed = discord.Embed (
title = "Command Navigation",
timestamp = ctx.message.created_at,
color = 0x232323
)
embed.add_field (
name = ': eyes: Bot information',
value = '.info'
)
embed.add_field (
name = ": detective: Utilities",
value = ".utilities",
inline = False
)
embed.add_field (
name = ": video_game: Interesting game",
value = ".game",
inline = False
)
embed.add_field (
name = ": hammer_pick: Moderation Commands",
value = ".moderation",
inline = True
)
embed.add_field (
name = ": radio: Ping",
value = ".ping",
inline = True
)
embed.add_field (
name = "Add bot to your server",
value = "[Link to add] ({0.invite})". format (self),
inline = False
)
embed.add_field (
name = "Official bot server",
value = "[Click] ({0.server})". format (self),
inline = False
)
await ctx.send (embed = embed)
def setup (bot):
bot.add_cog (Help (bot))
Then, in the main bot file, write the following:
bot.load_extension ('cog.help') # here you need to specify the path to the file, for example, you have a folder called cog