async def avatar(self, ctx): znaleziono = False avatar = str(ctx.author.avatar_url) connection = mysql.connector.connect(**configMysql) cursor = connection.cursor() sql_select_Query = "select used from `synchronizacja-dsc` WHERE account_discord=" + str( ctx.author.id) cursor.execute(sql_select_Query) records = cursor.fetchall() for row in records: if row[0] == 'tak': znaleziono = True sql = "UPDATE `synchronizacja-dsc` SET avatar = %s WHERE account_discord=%s" val = (avatar, ctx.author.id) cursor.execute(sql, val) connection.commit() embed = discord.Embed(title="Twój Avatar", description="", color=config.configCheck('embed_color')) embed.set_thumbnail(url=avatar) await ctx.send(embed=embed) if znaleziono == False: await ctx.send('Nie posiadasz połączonego konta!') connection.close() cursor.close()
async def status(self, ctx): object = checkSerwer(ip, port) players = object.players + "/" + object.maxplayers embed = discord.Embed(title=object.name, description="Informacje o serwerze:", color=config.configCheck('embed_color')) embed.add_field(name="Online", value=players, inline=True) embed.add_field(name="Adres IP", value='mtasa://' + ip + ':' + str(port), inline=True) await ctx.send(embed=embed)
async def serwer(self, ctx): online = [] offline = [] for user in ctx.guild.members: if user.status != discord.Status.offline: online.append(user) else: offline.append(user) guild = ctx.author.guild description = guild.name + '\n:green_circle: Online: ' + str( len(online)) + '\n:red_circle: Offline: ' + str( len(offline)) + '\nRegion: ' + str( guild.region) + '\nWłaściciel: ' + guild.owner.display_name embed = discord.Embed(title="Informacje Serwerowe", description=description, color=config.configCheck('embed_color')) icon = guild.icon_url embed.set_thumbnail(url=icon) await ctx.send(embed=embed)
#AUTHOR: duhack #GITHUB: https://github.com/duhack #WWW: https://duhack.pl/ import discord import statusAPI import config import mysql.connector from statusAPI import checkSerwer from discord.ext import commands from discord.utils import get ip = config.configCheck('ip') port = config.configCheck('port') configMysql = { 'user': config.configCheck('user'), #uzytkownik bazy danych 'password': config.configCheck('password'), #haslo do bazy danych 'host': config.configCheck('host'), #ip bazy danych 'database': config.configCheck('database'), #baza danych } inviteRanks = [ #ranga, próg ['🏳️', 0], ['🏴', 5], ['🚩', 10], ['🔥', 15], ['🚀', 20], ['💎', 25], ['👑', 50],