Answer the question
In order to leave comments, you need to log in
How to show two different values from two different dictionaries (in a discord bot)?
in general, I do the code:
import discord
from discord.ext import commands
from discord.ext import tasks
from time import time, localtime
user_counter = {}
user_kolvo = {}
msg = 'Статистика:\n'
client = commands.Bot( command_prefix = '-')
@tasks.loop(seconds=20)
async def timer_notify():
await client.wait_until_ready()
cur_time = localtime(time())
my_channel = client.get_channel(734611425368211457)
for user_id,counter in user_counter.items():
user = client.get_user(user_id)
global msg
msg = msg+' >> ' + user.name + ': ' + str(counter) + ' подходов' + ' | ' + str(kolvo) + ' раз' + '\n'
await my_channel.send(msg)
msg = 'Статистика:\n'
msg = msg+' >> ' + user.name + ': ' + str(counter) + ' подходов' + ' | ' + str(user_kolvo.values()) + ' раз' + '\n'
for user_id,counter in user_counter.items() and user_id,kolvo in user_kolvo.items()
Answer the question
In order to leave comments, you need to log in
for user_id,counter in user_counter.items():
...
msg += "Ой, а вот у **%s** целых %d подходов %d раз" % (user.name, counter, user_kolvo[user_id])
for user_id in user_counter:
...
msg += "Ой, а вот у **%s** целых %d подходов %d раз" % (user.name, user_counter[user_id], user_kolvo[user_id])
user_data[user_id] = { "counter": число, "quantity": число, "birthday": "32.05.1700" }
...
for user_id in user_data:
msg += "Ой, а вот у **%s** целых %d подходов %d раз" % (user.name, user_data[user_id]["counter"], user_data[user_id]["quantity"])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question