aboutsummaryrefslogtreecommitdiff
path: root/cogs/general.py
blob: 57dbbc10260663a6ddbd0bafa28034fb0d245787 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from discord.ext import commands
import discord
import asyncio

class General(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command()
    async def add(self, ctx):
        """Show link to invite ziBot."""
        oauth_link = "https://discord.com/oauth2/authorize?client_id=740122842988937286&scope=bot"
        await ctx.send(f"To add ziBot to your server, click here: \n {oauth_link}")
    
    @commands.command()
    async def source(self, ctx):
        """Show link to ziBot's source code."""
        git_link = "https://github.com/null2264/ziBot"
        await ctx.send(f"ziBot's source code: \n {git_link}")

    @commands.command()
    async def serverinfo(self, ctx):
        """Show server information"""
        embed = discord.Embed(
                title=f"{ctx.guild.name} Information",
                colour=discord.Colour.orange()
                )
        # embed.set_author(name=f"{ctx.guild.name} Information")
        embed.set_thumbnail(url=ctx.guild.icon_url)
        _emoji=""
        member_count=len(ctx.guild.members)
        embed.add_field(name="Members",value=f"{member_count}")
        for emoji in ctx.guild.emojis:
            _emoji+= ", ".join([f"{str(emoji)}"])
        embed.add_field(name="Emojis",value=f"{_emoji}")
        await ctx.send(embed=embed)

def setup(bot):
    bot.add_cog(General(bot))