[NF] Zway-Bot hinzugefügt
[NF] Viele kleine Änderungen an Zwaylib zur Verbesserung der Kompatibilität
This commit is contained in:
parent
d25c1ff831
commit
26024a4518
@ -32,7 +32,7 @@ namespace BlubbFish.Utils.IoT.Connector.User {
|
|||||||
|
|
||||||
public async override void Send(String message) {
|
public async override void Send(String message) {
|
||||||
try {
|
try {
|
||||||
Message x = await this.bot.SendTextMessageAsync(this.chat, message);
|
Message x = await this.bot.SendTextMessageAsync(this.chat, message, ParseMode.Default, false, false, 0, new ReplyKeyboardRemove());
|
||||||
this.MessageSending?.Invoke(this, new UserMessageEventArgs(x.Text, x.Chat.Id, x.Date));
|
this.MessageSending?.Invoke(this, new UserMessageEventArgs(x.Text, x.Chat.Id, x.Date));
|
||||||
} catch(ApiRequestException e) {
|
} catch(ApiRequestException e) {
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
@ -49,9 +49,13 @@ namespace BlubbFish.Utils.IoT.Connector.User {
|
|||||||
|
|
||||||
public async override void Send(String message, String[] buttons) {
|
public async override void Send(String message, String[] buttons) {
|
||||||
try {
|
try {
|
||||||
KeyboardButton[] button = new KeyboardButton[buttons.Length];
|
KeyboardButton[][] button = new KeyboardButton[(Int32)Math.Ceiling(((Double)buttons.Length)/2)][];
|
||||||
for(Int32 i = 0; i < button.Length; i++) {
|
for(Int32 i = 0; i < buttons.Length; i++) {
|
||||||
button[i] = new KeyboardButton(buttons[i]);
|
Int32 j = (Int32)Math.Floor(((Double)i) / 2);
|
||||||
|
if (i % 2 == 0) {
|
||||||
|
button[j] = new KeyboardButton[(j == button.Length - 1) ? ((buttons.Length % 2 == 0) ? 2 : buttons.Length % 2) : 2];
|
||||||
|
}
|
||||||
|
button[j][i % 2] = new KeyboardButton(buttons[i]);
|
||||||
}
|
}
|
||||||
Message x = await this.bot.SendTextMessageAsync(this.chat, message, ParseMode.Default, false, false, 0, new ReplyKeyboardMarkup(button,true,true));
|
Message x = await this.bot.SendTextMessageAsync(this.chat, message, ParseMode.Default, false, false, 0, new ReplyKeyboardMarkup(button,true,true));
|
||||||
this.MessageSending?.Invoke(this, new UserMessageEventArgs(x.Text, x.Chat.Id, x.Date));
|
this.MessageSending?.Invoke(this, new UserMessageEventArgs(x.Text, x.Chat.Id, x.Date));
|
||||||
|
Loading…
Reference in New Issue
Block a user