Ich versuche, ein xp-System für AC# Diskord Bot zu machen, aber meine Int speichern nicht außerhalb des Befehls zum Beispiel um das Guthaben zu überprüfen oder andere Artikel zu kaufen, die ich den Wert von dort überprüfen müsste ganze Zahl. Müsste ich diese Daten in einer SQL-Datenbank speichern, oder wäre es möglich, sie im Visual Studio als Int zu belassen? Vielen Dank.Discord Bot C# XP System
public class Buy : ModuleBase<SocketCommandContext>
{
int coins = 24;
int coins2buymeme = 23;
[Command("buyrole")]
public async Task Ishoping (IGuildUser user, IRole role)
{
string invite_code = "you have sucesfully purchased the " + role + " role for " + coins2buymeme + " coins !!!";
await Context.Channel.SendMessageAsync(invite_code);
await user.AddRoleAsync(role);
Console.WriteLine("User bought" + role + "for" + coins2buymeme + "if you are not happy with this decision please change there roles on server manually");
this.coins -= coins2buymeme;
Console.WriteLine("your new balance is " + this.coins + " if you are not happy with this decision please change there roles on server manually");
const int delay = 90000;
string bought = "your new balance is " + this.coins + " if you are not happy with this decision please change there roles on server manually";
await Context.Channel.SendMessageAsync(bought);
}
[Command("refund")]
public async Task Ishopidang(IGuildUser user, IRole roles)
{
string invite_code = "you have sucesfully refunded the " + roles + " role for " + coins2buymeme + " coins !!!";
await Context.Channel.SendMessageAsync(invite_code);
await user.RemoveRoleAsync(roles);
Console.WriteLine("User refunded" + roles + "for" + coins2buymeme + "if you are not happy with this decision please change there roles on server manually");
}
[Command("balance")]
public async Task Ishopiddang(IGuildUser user)
{
await Context.Channel.SendMessageAsync("you have " + this.coins + " to spend use !shop to find out more");
Console.WriteLine("User has " + this.coins + "if you are not happy with this decision please change there roles on server manually");
}
}
}
Was 'int' Sie sich beziehen? –
Die Münzen int, so dass, wenn ein Benutzer eine Mem-Rolle kauft, die Münzmenge sinkt und sie in der Lage sein werden, sie in ihrem Kontostand zu sehen. –